Avoid duplicates in missing hashes reports.
authorAntony Chazapis <chazapis@gmail.com>
Mon, 12 Sep 2011 07:00:05 +0000 (10:00 +0300)
committerAntony Chazapis <chazapis@gmail.com>
Mon, 12 Sep 2011 07:00:05 +0000 (10:00 +0300)
pithos/backends/lib/hashfiler/blocker.py

index 4081e71..817376b 100644 (file)
@@ -98,7 +98,14 @@ class Blocker(object):
         """Check hashes for existence and
            return those missing from block storage.
         """
-        return [h for h in hashes if not self._check_rear_block(h)]
+        notfound = []
+        append = notfound.append
+
+        for h in hashes:
+            if h not in notfound and not self._check_rear_block(h):
+                append(h)
+
+        return notfound
 
     def block_retr(self, hashes):
         """Retrieve blocks from storage by their hashes."""