trackdb: Retry saving if something goes wrong
Occasionally we have a problem with tags changing during pickling. If this happens, reschedule the save for later and hope it doesn't happen again Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
d1456b14bd
commit
11c9f0b267
|
@ -63,8 +63,11 @@ Library = LibraryStore()
|
|||
|
||||
|
||||
def _do_save():
|
||||
with lib.data.DataFile(File, lib.data.WRITE) as f:
|
||||
f.pickle([ tags.get_state(), Tracks, Library ])
|
||||
try:
|
||||
with lib.data.DataFile(File, lib.data.WRITE) as f:
|
||||
f.pickle([ tags.get_state(), Tracks, Library ])
|
||||
except Exception as e:
|
||||
return lib.bus.RETRY
|
||||
|
||||
def save(*args):
|
||||
Bus.board(_do_save)
|
||||
|
|
Loading…
Reference in New Issue