mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Aggiornato updater
This commit is contained in:
parent
294e875236
commit
f67c68e1f5
1 changed files with 111 additions and 100 deletions
19
update.py
19
update.py
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue