got rid of use of set to keep track of obj hashes
This commit is contained in:
parent
71b076eb59
commit
b2f42cdce8
@ -132,23 +132,23 @@ class ObjectUpdater(Daemon):
|
|||||||
prefix_path = os.path.join(async_pending, prefix)
|
prefix_path = os.path.join(async_pending, prefix)
|
||||||
if not os.path.isdir(prefix_path):
|
if not os.path.isdir(prefix_path):
|
||||||
continue
|
continue
|
||||||
seen = set()
|
last_obj_hash = None
|
||||||
for update in sorted(os.listdir(prefix_path), reverse=True):
|
for update in sorted(os.listdir(prefix_path), reverse=True):
|
||||||
update_path = os.path.join(prefix_path, update)
|
update_path = os.path.join(prefix_path, update)
|
||||||
if not os.path.isfile(update_path):
|
if not os.path.isfile(update_path):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
hash, timestamp = update.split('-')
|
obj_hash, timestamp = update.split('-')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_('ERROR async pending file with unexpected name %s')
|
_('ERROR async pending file with unexpected name %s')
|
||||||
% (update_path))
|
% (update_path))
|
||||||
continue
|
continue
|
||||||
if hash in seen:
|
if obj_hash == last_obj_hash:
|
||||||
os.unlink(update_path)
|
os.unlink(update_path)
|
||||||
else:
|
else:
|
||||||
self.process_object_update(update_path, device)
|
self.process_object_update(update_path, device)
|
||||||
seen.add(hash)
|
last_obj_hash = obj_hash
|
||||||
time.sleep(self.slowdown)
|
time.sleep(self.slowdown)
|
||||||
try:
|
try:
|
||||||
os.rmdir(prefix_path)
|
os.rmdir(prefix_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user