diff --git a/lbrynet/core/BlobManager.py b/lbrynet/core/BlobManager.py index f2701c444..b54f719d8 100644 --- a/lbrynet/core/BlobManager.py +++ b/lbrynet/core/BlobManager.py @@ -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)) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index 109be0aec..c83c45d6d 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -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()