1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Aggiornato updater

This commit is contained in:
Steffo 2018-06-09 17:23:12 +02:00
parent 294e875236
commit f67c68e1f5

View file

@ -2,9 +2,12 @@ import db
import errors import errors
import time import time
session = db.Session() session = None
# Stop updating if Ctrl-C is pressed # Stop updating if Ctrl-C is pressed
try: try:
while True:
global session
session = db.Session()
# Update Steam # Update Steam
print("STEAM") print("STEAM")
for user in session.query(db.Steam).all(): for user in session.query(db.Steam).all():
@ -101,9 +104,17 @@ try:
finally: finally:
sleep_time = 1 - time.clock() + t sleep_time = 1 - time.clock() + t
time.sleep(sleep_time if sleep_time > 0 else 0) time.sleep(sleep_time if sleep_time > 0 else 0)
except KeyboardInterrupt:
pass
finally:
print("Committing...\t\t") print("Committing...\t\t")
session.commit() session.commit()
print("OK") print("OK")
print("Closing...\n\n")
session.close()
print("OK")
except KeyboardInterrupt:
pass
finally:
print("Closing...")
try:
session.close()
except Exception:
print("Maybe")