forked from LBRYCommunity/lbry-sdk
Merge pull request #434 from lbryio/ensure-tmp-blobs-deleted
Bug fix: delete empty blobs
This commit is contained in:
commit
ec873129d5
1 changed files with 3 additions and 8 deletions
|
@ -392,16 +392,11 @@ class BlobFileCreator(HashBlobCreator):
|
||||||
def _close(self):
|
def _close(self):
|
||||||
temp_file_name = self.out_file.name
|
temp_file_name = self.out_file.name
|
||||||
self.out_file.close()
|
self.out_file.close()
|
||||||
|
|
||||||
def change_file_name():
|
|
||||||
shutil.move(temp_file_name, os.path.join(self.blob_dir, self.blob_hash))
|
|
||||||
return True
|
|
||||||
|
|
||||||
if self.blob_hash is not None:
|
if self.blob_hash is not None:
|
||||||
d = threads.deferToThread(change_file_name)
|
shutil.move(temp_file_name, os.path.join(self.blob_dir, self.blob_hash))
|
||||||
else:
|
else:
|
||||||
d = defer.succeed(True)
|
os.remove(temp_file_name)
|
||||||
return d
|
return defer.succeed(True)
|
||||||
|
|
||||||
def _write(self, data):
|
def _write(self, data):
|
||||||
self.out_file.write(data)
|
self.out_file.write(data)
|
||||||
|
|
Loading…
Reference in a new issue