* potential fix for #2323 * Update DbCursor.py * replaced RLock with Lock
This commit is contained in:
parent
966f393e20
commit
89e8fd3d3a
1 changed files with 15 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
import time
|
||||
import re
|
||||
import gevent
|
||||
from gevent._threading import Lock
|
||||
from util import helper
|
||||
|
||||
|
||||
|
@ -14,6 +15,7 @@ class DbCursor:
|
|||
self.db = db
|
||||
self.cursor = conn.cursor()
|
||||
self.logging = False
|
||||
self.lock = Lock()
|
||||
|
||||
def quoteValue(self, value):
|
||||
if type(value) is int:
|
||||
|
@ -99,6 +101,8 @@ class DbCursor:
|
|||
|
||||
s = time.time()
|
||||
|
||||
try:
|
||||
self.lock.acquire(True)
|
||||
if params: # Query has parameters
|
||||
res = self.cursor.execute(query, params)
|
||||
if self.logging:
|
||||
|
@ -107,6 +111,8 @@ class DbCursor:
|
|||
res = self.cursor.execute(query)
|
||||
if self.logging:
|
||||
self.db.log.debug(query + " (Done in %.4f)" % (time.time() - s))
|
||||
finally:
|
||||
self.lock.release()
|
||||
|
||||
# Log query stats
|
||||
if self.db.collect_stats:
|
||||
|
|
Loading…
Reference in a new issue