From a692b6ff7dae29c7ae0654c4fe760b429f5def58 Mon Sep 17 00:00:00 2001 From: hackrush Date: Thu, 11 Oct 2018 00:28:46 +0530 Subject: [PATCH] Pass SQLite storage object to DiskBlobManager for single(temp) blob download --- lbrynet/core/SinglePeerDownloader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lbrynet/core/SinglePeerDownloader.py b/lbrynet/core/SinglePeerDownloader.py index 8ec6c8880..e81e0f033 100644 --- a/lbrynet/core/SinglePeerDownloader.py +++ b/lbrynet/core/SinglePeerDownloader.py @@ -11,6 +11,7 @@ from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager from lbrynet.core.client.BlobRequester import BlobRequester from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader from lbrynet.core.client.ConnectionManager import ConnectionManager +from lbrynet.database.storage import SQLiteStorage from lbrynet.dht.peerfinder import DummyPeerFinder @@ -96,10 +97,13 @@ class SinglePeerDownloader: @defer.inlineCallbacks def download_temp_blob_from_peer(self, peer, timeout, blob_hash): tmp_dir = yield threads.deferToThread(tempfile.mkdtemp) - tmp_blob_manager = DiskBlobManager(tmp_dir, tmp_dir) + tmp_storage = SQLiteStorage(tmp_dir) + yield tmp_storage.setup() + tmp_blob_manager = DiskBlobManager(tmp_dir, tmp_storage) try: result = yield self.download_blob_from_peer(peer, timeout, blob_hash, tmp_blob_manager) finally: yield tmp_blob_manager.stop() + yield tmp_storage.stop() yield threads.deferToThread(shutil.rmtree, tmp_dir) defer.returnValue(result)