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

View file

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