Execute db commit in separate thread
This commit is contained in:
parent
ec3c44c5b3
commit
1670d96908
1 changed files with 4 additions and 0 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue