forkeado de spla/fediverse
Fix #3, same datetime for all checked servers
This commit is contained in:
pare
0b52e0090d
commit
9ef90164b0
S'han modificat 2 arxius amb 12 adicions i 7 eliminacions
14
fediverse.py
14
fediverse.py
|
@ -16,6 +16,7 @@ from itertools import product
|
|||
import socket
|
||||
import matplotlib.pyplot as plt
|
||||
import pdb
|
||||
|
||||
plt.style.use('seaborn')
|
||||
|
||||
start_time = time.time()
|
||||
|
@ -33,7 +34,7 @@ class Server:
|
|||
|
||||
name = 'Server'
|
||||
|
||||
def __init_(self, server, software, users, alive, api, soft_version):
|
||||
def __init_(self, server, software, users, alive, api, soft_version, now):
|
||||
|
||||
self.server = server
|
||||
self.software = software
|
||||
|
@ -41,12 +42,13 @@ class Server:
|
|||
self.alive = alive
|
||||
self.api = api
|
||||
self.version = self.soft_version
|
||||
self.now = now
|
||||
|
||||
def get_alive_servers(self, *args):
|
||||
|
||||
fediverse_db, fediverse_db_user = db_config()
|
||||
|
||||
now = datetime.now()
|
||||
now = self.now
|
||||
|
||||
if len(args) != 0:
|
||||
|
||||
|
@ -431,6 +433,8 @@ if __name__ == '__main__':
|
|||
|
||||
set_start_method("spawn")
|
||||
|
||||
now = datetime.now()
|
||||
|
||||
mastodon, mastodon_hostname = mastodon()
|
||||
|
||||
fediverse_db, fediverse_db_user = db_config()
|
||||
|
@ -444,6 +448,8 @@ if __name__ == '__main__':
|
|||
|
||||
getservers = Server()
|
||||
|
||||
getservers.now = datetime.now()
|
||||
|
||||
###########################################################################
|
||||
# multiprocessing!
|
||||
|
||||
|
@ -471,6 +477,8 @@ if __name__ == '__main__':
|
|||
|
||||
getservers = Server()
|
||||
|
||||
getservers.now = datetime.now()
|
||||
|
||||
i = 0
|
||||
|
||||
while i < len(alive_servers):
|
||||
|
@ -793,4 +801,4 @@ if __name__ == '__main__':
|
|||
|
||||
users_image_id = mastodon.media_post('users.png', "image/png", description='users graph').id
|
||||
|
||||
#mastodon.status_post(toot_text, in_reply_to_id=None, media_ids={servers_image_id, users_image_id})
|
||||
mastodon.status_post(toot_text, in_reply_to_id=None, media_ids={servers_image_id, users_image_id})
|
||||
|
|
|
@ -25,8 +25,6 @@ def get_uptime():
|
|||
|
||||
row = cur.fetchone()
|
||||
|
||||
if row[0] != timedelta(0):
|
||||
|
||||
max_uptime = row[0]
|
||||
|
||||
cur.execute("select count(server) from fediverse where last_checked_at-first_checked_at=(%s)", (max_uptime,))
|
||||
|
@ -151,7 +149,6 @@ def get_parameter(parameter, file_path):
|
|||
print(file_path + " Missing parameter %s "%parameter)
|
||||
sys.exit(0)
|
||||
|
||||
###############################################################################
|
||||
# main
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Referencia en una nova incidència