delete upload memory file file on shutdown if upload queue is empty
This commit is contained in:
parent
ee7b68c844
commit
d7be2ca16d
@ -59,5 +59,11 @@ class UploadQueue:
|
|||||||
def save(self):
|
def save(self):
|
||||||
"""Save to disk on shutdown or if called manually."""
|
"""Save to disk on shutdown or if called manually."""
|
||||||
bl: deadsimplekv.DeadSimpleKV = self.communicator.blocksToUpload
|
bl: deadsimplekv.DeadSimpleKV = self.communicator.blocksToUpload
|
||||||
|
if len(bl) == 0:
|
||||||
|
try:
|
||||||
|
os.remove(UPLOAD_MEMORY_FILE)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
self.store_obj.put('uploads', bl)
|
self.store_obj.put('uploads', bl)
|
||||||
self.store_obj.flush()
|
self.store_obj.flush()
|
||||||
|
Loading…
Reference in New Issue
Block a user