delete upload memory file file on shutdown if upload queue is empty
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
|
||||||
self.store_obj.put('uploads', bl)
|
if len(bl) == 0:
|
||||||
self.store_obj.flush()
|
try:
|
||||||
|
os.remove(UPLOAD_MEMORY_FILE)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.store_obj.put('uploads', bl)
|
||||||
|
self.store_obj.flush()
|
||||||
|
|
Loading…
Reference in New Issue