forked from LBRYCommunity/lbry-sdk
Merge pull request #430 from lbryio/more-verified-time
missed another verified time check
This commit is contained in:
commit
e37fbc4fdb
2 changed files with 6 additions and 4 deletions
|
@ -309,15 +309,14 @@ class DiskBlobManager(BlobManager):
|
||||||
|
|
||||||
@rerun_if_locked
|
@rerun_if_locked
|
||||||
def _get_all_verified_blob_hashes(self):
|
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):
|
def get_verified_blobs(blobs):
|
||||||
verified_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)
|
file_path = os.path.join(self.blob_dir, blob_hash)
|
||||||
if os.path.isfile(file_path):
|
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
|
return verified_blobs
|
||||||
|
|
||||||
d.addCallback(lambda blobs: threads.deferToThread(get_verified_blobs, blobs))
|
d.addCallback(lambda blobs: threads.deferToThread(get_verified_blobs, blobs))
|
||||||
|
|
|
@ -184,6 +184,9 @@ class AlwaysSend(object):
|
||||||
return d
|
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
|
@defer.inlineCallbacks
|
||||||
def calculate_available_blob_size(blob_manager):
|
def calculate_available_blob_size(blob_manager):
|
||||||
blob_hashes = yield blob_manager.get_all_verified_blobs()
|
blob_hashes = yield blob_manager.get_all_verified_blobs()
|
||||||
|
|
Loading…
Reference in a new issue