1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-12-17 23:24: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 time
session = db.Session()
session = None
# Stop updating if Ctrl-C is pressed
try:
while True:
global session
session = db.Session()
# Update Steam
print("STEAM")
for user in session.query(db.Steam).all():
@ -101,9 +104,17 @@ try:
finally:
sleep_time = 1 - time.clock() + t
time.sleep(sleep_time if sleep_time > 0 else 0)
except KeyboardInterrupt:
pass
finally:
print("Committing...\t\t")
session.commit()
print("OK")
print("Closing...\n\n")
session.close()
print("OK")
except KeyboardInterrupt:
pass
finally:
print("Closing...")
try:
session.close()
except Exception:
print("Maybe")