Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pandaharvester/harvestercore/db_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,12 @@ def commit(self):
if harvester_config.db.verbose:
self.verbLog.debug(f"thr={self.thrName} exception during commit")
raise
if self.usingAppLock and self.lockDB:
if harvester_config.db.verbose:
self.verbLog.debug(f"thr={self.thrName} release with commit")
conLock.release()
self.lockDB = False
finally:
if self.usingAppLock and self.lockDB:
if harvester_config.db.verbose:
self.verbLog.debug(f"thr={self.thrName} release with commit")
conLock.release()
self.lockDB = False

# rollback
def rollback(self):
Expand Down
6 changes: 4 additions & 2 deletions pandaharvester/harvestercore/db_proxy_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, method_name, pool):
def __call__(self, *args, **kwargs):
tmpLog = core_utils.make_logger(_logger, f"method={self.methodName}", method_name="call")
sw = core_utils.get_stopwatch()
con = None
try:
# get connection
con = self.pool.get()
Expand All @@ -32,8 +33,9 @@ def __call__(self, *args, **kwargs):
# exec
return func(*args, **kwargs)
finally:
tmpLog.debug("release lock" + sw.get_elapsed_time())
self.pool.put(con)
if con is not None:
tmpLog.debug("release lock" + sw.get_elapsed_time())
self.pool.put(con)


# connection class
Expand Down