Close and commit all db at exit

This commit is contained in:
shortcutme 2019-03-18 03:32:42 +01:00
parent a5ce7e5a1f
commit 9aa599f9d2
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -4,6 +4,8 @@ import time
import logging
import re
import os
import atexit
import gevent
from Debug import Debug
@ -35,8 +37,13 @@ def dbCommitCheck():
db.need_commit = False
time.sleep(0.1)
def dbCloseAll():
for db in opened_dbs[:]:
db.close()
gevent.spawn(dbCleanup)
gevent.spawn(dbCommitCheck)
atexit.register(dbCloseAll)
class Db(object):