Revision: 321
Author: bslatkin
Date: Wed Feb 3 09:37:28 2010
Log: hub EventToDeliver clean-up should only use age; removed unused index
http://code.google.com/p/pubsubhubbub/source/detail?r=321
Modified:
/trunk/hub/index.yaml
/trunk/hub/main.py
/trunk/hub/main_test.py
=======================================
--- /trunk/hub/index.yaml Wed Sep 23 23:32:10 2009
+++ /trunk/hub/index.yaml Wed Feb 3 09:37:28 2010
@@ -1,11 +1,5 @@
indexes:
-# For cleaning up EventToDeliver instances.
-- kind: EventToDeliver
- properties:
- - name: totally_failed
- - name: last_modified
-
# For iterating through subscribers to deliver events to.
- kind: Subscription
properties:
=======================================
--- /trunk/hub/main.py Thu Jan 21 19:50:37 2010
+++ /trunk/hub/main.py Wed Feb 3 09:37:28 2010
@@ -2426,7 +2426,6 @@
threshold = (self.now() -
datetime.timedelta(seconds=EVENT_CLEANUP_MAX_AGE_SECONDS))
events = (EventToDeliver.all()
- .filter('totally_failed =', True)
.filter('last_modified <=', threshold)
.order('last_modified').fetch(EVENT_CLEANUP_CHUNK_SIZE))
if events:
=======================================
--- /trunk/hub/main_test.py Thu Jan 21 19:50:37 2010
+++ /trunk/hub/main_test.py Wed Feb 3 09:37:28 2010
@@ -2403,20 +2403,11 @@
self.topic = 'http://example.com/mytopic'
self.header_footer = '<feed></feed>'
- def testNoEvents(self):
- """Tests when there are no failed events to clean up."""
- event = EventToDeliver.create_event_for_topic(
- self.topic, main.ATOM, self.header_footer, [])
- event.put()
- self.handle('get')
- self.assertTrue(db.get(event.key()) is not None)
-
def testEventCleanupTooYoung(self):
"""Tests when there are events present, but they're too young to
remove."""
event = EventToDeliver.create_event_for_topic(
self.topic, main.ATOM, self.header_footer, [])
event.last_modified = self.expire_time + datetime.timedelta(seconds=1)
- event.totally_failed = True
event.put()
self.handle('get')
self.assertTrue(db.get(event.key()) is not None)
@@ -2426,7 +2417,6 @@
event = EventToDeliver.create_event_for_topic(
self.topic, main.ATOM, self.header_footer, [])
event.last_modified = self.expire_time
- event.totally_failed = True
event.put()
too_young_event = EventToDeliver.create_event_for_topic(