# HG changeset patch # User Jonathan Griffin # Date 1352762829 0 # Node ID 71c36a7842d18ef9784e8ba359a3ef29bc93c5a2 # Parent 608df6b3de80ec987d3044d50175f224651a1326 Use mtime to determine most recent update; don't cache updates since timestamps can change. diff -r 608df6b3de80 -r 71c36a7842d1 dogdish/dispatcher.py --- 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]