Handle keyboard interrupt
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
23be5d6cc3
commit
5bd5d9da92
1 changed files with 30 additions and 27 deletions
|
@ -85,6 +85,7 @@ db = pymysql.connect("localhost", dbuser, dbpw, "worldbuild")
|
||||||
|
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
sql = "SELECT topLevel.name AS topLevelName, status.name AS statusName, COUNT(*) AS sCount from secondLevel JOIN topLevel ON secondLevel.parent_id = topLevel.id JOIN status ON secondLevel.status_id = status.id GROUP BY status.id, topLevelName"
|
sql = "SELECT topLevel.name AS topLevelName, status.name AS statusName, COUNT(*) AS sCount from secondLevel JOIN topLevel ON secondLevel.parent_id = topLevel.id JOIN status ON secondLevel.status_id = status.id GROUP BY status.id, topLevelName"
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
|
@ -113,3 +114,5 @@ while True:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
sleep(repeat * 60)
|
sleep(repeat * 60)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Exiting...")
|
||||||
|
|
Loading…
Add table
Reference in a new issue