got rid of use of set to keep track of obj hashes

This commit is contained in:
Greg Lange 2011-04-21 15:18:34 +00:00
parent 71b076eb59
commit b2f42cdce8

View File

@ -132,23 +132,23 @@ class ObjectUpdater(Daemon):
prefix_path = os.path.join(async_pending, prefix)
if not os.path.isdir(prefix_path):
continue
seen = set()
last_obj_hash = None
for update in sorted(os.listdir(prefix_path), reverse=True):
update_path = os.path.join(prefix_path, update)
if not os.path.isfile(update_path):
continue
try:
hash, timestamp = update.split('-')
obj_hash, timestamp = update.split('-')
except ValueError:
self.logger.error(
_('ERROR async pending file with unexpected name %s')
% (update_path))
continue
if hash in seen:
if obj_hash == last_obj_hash:
os.unlink(update_path)
else:
self.process_object_update(update_path, device)
seen.add(hash)
last_obj_hash = obj_hash
time.sleep(self.slowdown)
try:
os.rmdir(prefix_path)