Delete blob hash from list when blob is deleted
This commit is contained in:
parent
8d095ab36f
commit
20e9ff2902
3 changed files with 6 additions and 0 deletions
|
@ -17,6 +17,7 @@ at anytime.
|
||||||
* Fixed external IP detection via jsonip.com (avoid detecting IPv6)
|
* Fixed external IP detection via jsonip.com (avoid detecting IPv6)
|
||||||
* Fixed failing ConnectionManager unit test for parallel connections
|
* Fixed failing ConnectionManager unit test for parallel connections
|
||||||
* Fixed race condition between `publish` and `channel_new`
|
* Fixed race condition between `publish` and `channel_new`
|
||||||
|
* Fixed incorrect response on attempting to delete blob twice
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
|
|
@ -153,6 +153,7 @@ class DiskBlobManager(DHTHashSupplier):
|
||||||
blob = yield self.get_blob(blob_hash)
|
blob = yield self.get_blob(blob_hash)
|
||||||
yield blob.delete()
|
yield blob.delete()
|
||||||
bh_to_delete_from_db.append(blob_hash)
|
bh_to_delete_from_db.append(blob_hash)
|
||||||
|
del self.blobs[blob_hash]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning("Failed to delete blob file. Reason: %s", e)
|
log.warning("Failed to delete blob file. Reason: %s", e)
|
||||||
yield self._delete_blobs_from_db(bh_to_delete_from_db)
|
yield self._delete_blobs_from_db(bh_to_delete_from_db)
|
||||||
|
|
|
@ -83,6 +83,10 @@ class BlobManagerTest(unittest.TestCase):
|
||||||
self.assertEqual(len(blobs), 0)
|
self.assertEqual(len(blobs), 0)
|
||||||
blobs = yield self.bm._get_all_blob_hashes()
|
blobs = yield self.bm._get_all_blob_hashes()
|
||||||
self.assertEqual(len(blobs), 0)
|
self.assertEqual(len(blobs), 0)
|
||||||
|
self.assertFalse(blob_hash in self.bm.blobs)
|
||||||
|
|
||||||
|
# delete blob that was already deleted once
|
||||||
|
out = yield self.bm.delete_blobs([blob_hash])
|
||||||
|
|
||||||
# delete blob that does not exist, nothing will
|
# delete blob that does not exist, nothing will
|
||||||
# happen
|
# happen
|
||||||
|
|
Loading…
Reference in a new issue