diff --git a/lbrynet/blob/blob_file.py b/lbrynet/blob/blob_file.py index 80702d0aa..5ad21f7f7 100644 --- a/lbrynet/blob/blob_file.py +++ b/lbrynet/blob/blob_file.py @@ -132,16 +132,18 @@ class BlobFile: with open(self.file_path, 'rb') as handle: return await self.loop.sendfile(writer.transport, handle, count=self.get_length()) - async def close(self): + def close(self): while self.writers: self.writers.pop().finished.cancel() async def delete(self): - await self.close() + self.close() async with self.blob_write_lock: self.saved_verified_blob = False if os.path.isfile(self.file_path): os.remove(self.file_path) + self.verified.clear() + self.finished_writing.clear() def decrypt(self, key: bytes, iv: bytes) -> bytes: """ diff --git a/lbrynet/blob_exchange/downloader.py b/lbrynet/blob_exchange/downloader.py index ada08c471..3bcdc97f0 100644 --- a/lbrynet/blob_exchange/downloader.py +++ b/lbrynet/blob_exchange/downloader.py @@ -86,7 +86,7 @@ class BlobDownloader: peer, task = self.active_connections.popitem() if task and not task.done(): task.cancel() - await blob.close() + blob.close() log.debug("downloaded %s", blob_hash[:8]) return blob except asyncio.CancelledError: diff --git a/lbrynet/extras/daemon/Components.py b/lbrynet/extras/daemon/Components.py index 934177372..55b6d17c8 100644 --- a/lbrynet/extras/daemon/Components.py +++ b/lbrynet/extras/daemon/Components.py @@ -323,7 +323,7 @@ class BlobComponent(Component): async def stop(self): while self.blob_manager and self.blob_manager.blobs: _, blob = self.blob_manager.blobs.popitem() - await blob.close() + blob.close() async def get_status(self): count = 0 diff --git a/lbrynet/stream/descriptor.py b/lbrynet/stream/descriptor.py index 103f42e18..2e151be2f 100644 --- a/lbrynet/stream/descriptor.py +++ b/lbrynet/stream/descriptor.py @@ -86,7 +86,7 @@ class StreamDescriptor: writer = sd_blob.open_for_writing() writer.write(sd_data) await sd_blob.verified.wait() - await sd_blob.close() + sd_blob.close() return sd_blob @classmethod