Execute db commit in separate thread

This commit is contained in:
shortcutme 2019-11-30 02:12:33 +01:00
parent ec3c44c5b3
commit 1670d96908
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 4 additions and 0 deletions

View File

@ -14,7 +14,10 @@ from Debug import Debug
from .DbCursor import DbCursor
from util import SafeRe
from util import helper
from util import ThreadPool
from Config import config
thread_pool_db = ThreadPool.ThreadPool(config.threads_db)
opened_dbs = []
@ -115,6 +118,7 @@ class Db(object):
self.connect()
return self.cur.execute(query, params)
@thread_pool_db.wrap
def commit(self, reason="Unknown"):
if self.progress_sleeping:
self.log.debug("Commit ignored: Progress sleeping")