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
1 changed files with 7 additions and 0 deletions

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):