[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.100
Jeremy Hylton
jeremy@zope.com
Wed, 11 Sep 2002 15:55:31 -0400
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv28122
Modified Files:
FileStorage.py
Log Message:
Modify undoLog() to allow other threads to run periodically.
=== ZODB3/ZODB/FileStorage.py 1.99 => 1.100 ===
--- ZODB3/ZODB/FileStorage.py:1.99 Wed Sep 11 15:26:58 2002
+++ ZODB3/ZODB/FileStorage.py Wed Sep 11 15:55:30 2002
@@ -1091,13 +1091,19 @@
us = UndoSearch(self._file, self._pos, self._packt,
first, last, filter)
while not us.finished():
- us.search()
+ # Hold lock for batches of 20 searches, so default search
+ # parameters will finish without letting another thread run.
+ for i in range(20):
+ if us.finished():
+ break
+ us.search()
+ # Give another thread a chance, so that a long undoLog()
+ # operation doesn't block all other activity.
+ self._lock_release()
+ self._lock_acquire()
return us.results
finally:
self._lock_release()
-
- def undoFindNext(self, pos, result, first, i, filter):
- pass
def transactionalUndo(self, transaction_id, transaction):
"""Undo a transaction, given by transaction_id.