changeset 20:71c36a7842d1

Use mtime to determine most recent update; don't cache updates since timestamps can change.
author Jonathan Griffin <jgriffin@mozilla.com>
date Mon, 12 Nov 2012 23:27:09 +0000
parents 608df6b3de80
children ce97a26e4c03
files dogdish/dispatcher.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dogdish/dispatcher.py	Fri Oct 26 15:27:41 2012 +0000
+++ b/dogdish/dispatcher.py	Mon Nov 12 23:27:09 2012 +0000
@@ -51,6 +51,7 @@
         self.filename = filename
         self.path = os.path.join(directory, filename)
         self.stamp = filename[len(self.prefix):-len(self.suffix)]
+        self.modifiedTime = os.path.getmtime(self.path)
         self.size = os.path.getsize(self.path)
 
         # cached properties
@@ -207,12 +208,15 @@
         new = contents.difference(self.updates.keys())
         if not new:
             # directory contents unchanged from cached values
-            return False
+            # return False
+            # XXX: we can't rely on caching this, since in the case of a bad update,
+            # an earlier update will be promoted via 'touch'.
+            pass
 
-        for update in new:
+        for update in contents:
             self.updates[update] = self.update_class(self.directory, update)
             if self.current_update:
-                if self.updates[update].stamp > self.current_update.stamp:
+                if self.updates[update].modifiedTime > self.current_update.modifiedTime:
                     self.current_update = self.updates[update]
             else:
                 self.current_update = self.updates[update]