refactor BlobFile.close to be non async

This commit is contained in:
Jack Robison 2019-02-06 09:20:21 -05:00
parent f8dc0f298e
commit 0e972ec2ae
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
4 changed files with 7 additions and 5 deletions
lbrynet/blob

View file

@ -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:
"""