Browse Source

[->3.0] LimitedSet.purge must ignore KeyError

Ask Solem 12 years ago
parent
commit
7eda9293f0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      celery/datastructures.py

+ 4 - 1
celery/datastructures.py

@@ -598,7 +598,10 @@ class LimitedSet(object):
                 if time.time() < item[0] + self.expires:
                     heappush(H, item)
                     break
-            self._data.pop(item[1])
+            try:
+                self._data.pop(item[1])
+            except KeyError:  # out of sync with heap
+                pass
             i += 1
 
     def update(self, other, heappush=heappush):