missed another verified time check

This commit is contained in:
Job Evers-Meltzer 2017-01-20 18:47:53 +00:00
parent c62ee6bb0c
commit 3e774fc158
2 changed files with 6 additions and 4 deletions

View file

@ -309,15 +309,14 @@ class DiskBlobManager(BlobManager):
@rerun_if_locked
def _get_all_verified_blob_hashes(self):
d = self.db_conn.runQuery("select blob_hash, last_verified_time from blobs")
d = self.db_conn.runQuery("select blob_hash from blobs")
def get_verified_blobs(blobs):
verified_blobs = []
for blob_hash, verified_time in blobs:
for blob_hash, in blobs:
file_path = os.path.join(self.blob_dir, blob_hash)
if os.path.isfile(file_path):
if verified_time > os.path.getctime(file_path):
verified_blobs.append(blob_hash)
verified_blobs.append(blob_hash)
return verified_blobs
d.addCallback(lambda blobs: threads.deferToThread(get_verified_blobs, blobs))

View file

@ -184,6 +184,9 @@ class AlwaysSend(object):
return d
# If an instance has a lot of blobs, this call might get very expensive.
# For reflector, with 50k blobs, it definitely has an impact on the first run
# But doesn't seem to impact performance after that.
@defer.inlineCallbacks
def calculate_available_blob_size(blob_manager):
blob_hashes = yield blob_manager.get_all_verified_blobs()