- bsddb: multithreaded DB access using the simple bsddb module interface

now works reliably.  It has been updated to use automatic BerkeleyDB
  deadlock detection and the bsddb.dbutils.DeadlockWrap wrapper to retry
  database calls that would previously deadlock. [SF python bug #775414]
This commit is contained in:
Gregory P. Smith 2006-06-15 08:52:32 +00:00
parent c21e0566b2
commit 506f7b559a
3 changed files with 45 additions and 31 deletions

View file

@ -22,14 +22,14 @@
#
# import the time.sleep function in a namespace safe way to allow
# "from bsddb.db import *"
# "from bsddb.dbutils import *"
#
from time import sleep as _sleep
import db
# always sleep at least N seconds between retrys
_deadlock_MinSleepTime = 1.0/64
_deadlock_MinSleepTime = 1.0/128
# never sleep more than N seconds between retrys
_deadlock_MaxSleepTime = 3.14159
@ -57,7 +57,7 @@ def DeadlockWrap(function, *_args, **_kwargs):
max_retries = _kwargs.get('max_retries', -1)
if _kwargs.has_key('max_retries'):
del _kwargs['max_retries']
while 1:
while True:
try:
return function(*_args, **_kwargs)
except db.DBLockDeadlockError: