Back saving servers data to parallel processes
This commit is contained in:
pare
7256cf2a30
commit
8f987b48e3
S'han modificat 1 arxius amb 4 adicions i 31 eliminacions
35
fediverse.py
35
fediverse.py
|
@ -133,6 +133,8 @@ class Server:
|
|||
|
||||
print(f'\n** Server {server} ({software}) is alive! **')
|
||||
|
||||
write_alive_server(server, software, soft_version, alive, api, users, downs, first_checked_at)
|
||||
|
||||
except urllib3.exceptions.ProtocolError as protoerr:
|
||||
|
||||
print_dead(server)
|
||||
|
@ -193,6 +195,8 @@ class Server:
|
|||
|
||||
downs = 1
|
||||
|
||||
write_not_alive_server(server, software, soft_version, alive, api, users, downs, first_checked_at)
|
||||
|
||||
return (server, software, soft_version, alive, api, users, downs, first_checked_at)
|
||||
|
||||
def write_alive_server(server, software, soft_version, alive, api, users, downs, first_checked_at):
|
||||
|
@ -494,37 +498,6 @@ if __name__ == '__main__':
|
|||
|
||||
print(f"duration = {time.time() - start}.\nprocessed servers: {len(results)}")
|
||||
|
||||
all_servers = len(results)
|
||||
|
||||
server_num = 1
|
||||
|
||||
for server in results:
|
||||
|
||||
servername = server[0]
|
||||
software = server[1]
|
||||
soft_version = server[2]
|
||||
alive = server[3]
|
||||
api = server[4]
|
||||
users = server[5]
|
||||
downs = server[6]
|
||||
first_checked_at = server[7]
|
||||
|
||||
if alive:
|
||||
|
||||
print(f'** Saving server {server_num} of {all_servers}: {servername}, alive')
|
||||
|
||||
write_alive_server(servername, software, soft_version, alive, api, users, downs, first_checked_at)
|
||||
|
||||
else:
|
||||
|
||||
print(f'-- Saving server {server_num} of {all_servers}: {servername}, not alive')
|
||||
|
||||
first_checked_at = now if first_checked_at == None else first_checked_at
|
||||
|
||||
write_not_alive_server(servername, software, soft_version, alive, api, users, downs, first_checked_at)
|
||||
|
||||
server_num += 1
|
||||
|
||||
###########################################################################
|
||||
# get current total servers and users, get users from every software
|
||||
|
||||
|
|
Loading…
Referencia en una nova incidència