[Zope-Checkins] CVS: Zope/lib/python/Products/Transience - Transience.py:1.28.6.3

Chris McDonough chrism@zope.com
Thu, 9 Jan 2003 11:41:43 -0500


Update of /cvs-repository/Zope/lib/python/Products/Transience
In directory cvs.zope.org:/tmp/cvs-serv8651

Modified Files:
      Tag: Zope-2_6-branch
	Transience.py 
Log Message:
Merge "work around BTrees bug" fix from HEAD.


=== Zope/lib/python/Products/Transience/Transience.py 1.28.6.2 => 1.28.6.3 ===
--- Zope/lib/python/Products/Transience/Transience.py:1.28.6.2	Sat Oct 26 11:41:34 2002
+++ Zope/lib/python/Products/Transience/Transience.py	Thu Jan  9 11:41:41 2003
@@ -513,7 +513,7 @@
             # these keys, deindexing buckets as necessary when they're older
             # than the timeout.
             # XXX - fixme!  range search doesn't always work (btrees bug)
-            for k in data.keys(deindex_next, pprev):
+            for k in list(data.keys(deindex_next, pprev)):
                 if k < deindex_next:
                     DEBUG and TLOG(
                         'broken range search: key %s < min %s'
@@ -549,19 +549,26 @@
                 # if the bucket has keys, deindex them and add them to the
                 # notify queue (destruction notification happens during
                 # garbage collection)
-                bucket = data[k]
-                keys = bucket.keys()
+                bucket = data.get(k, _marker)
+                if bucket is _marker:
+                    DEBUG and TLOG(
+                        'data IOBTree lied about keys: %s doesnt exist' % k
+                        )
+                    continue
+                
+                keys = list(bucket.keys())
                 for key in keys:
                     ob = bucket.get(key, _marker)
                     if ob is _marker:
                         DEBUG and TLOG(
-                            'OOBTree lied about %s keys: %s doesnt exist' %
-                            (bucket, key)
+                            'bucket OOBTree lied about keys: %s doesnt exist' %
+                            key
                             )
                         continue
                     self.notify_queue.put((key, ob))
                 DEBUG and TLOG(
-                    '_getCurrentBucket: deindexing keys %s' % list(keys))
+                    '_getCurrentBucket: deindexing keys %s' % keys
+                    )
                 keys and self._deindex(keys)
                 # set the "last deindexed" pointer to k + period
                 deindex_next = k+period
@@ -685,7 +692,12 @@
                     % (k, delete_end)
                     )
                 continue
-            bucket = data[k]
+            bucket = data.get(k, _marker)
+            if bucket is _marker:
+                DEBUG and TLOG(
+                    'bucket OOBTree lied about keys: %s doesnt exist' % k
+                    )
+                continue
             # delete the bucket from _data
             del data[k]
             DEBUG and TLOG('_housekeep: deleted data[%s]' % k)