[#3080] Fix torrent reappearing on restart

If a magnet is added to new Deluge state, then deleted, it will reappear
on restart.

The problem results from torrents requiring both state and torrent file
but magnet only rely on the state file and the save_state code not
saving if the torrent list is empty. So torrents won't be loaded as
their torrent files have been deleted but magnets details remain in
state file and are loaded again on restart.

The fix is to always save the state file even if the state is empty.
This commit is contained in:
Calum Lind 2018-09-27 10:56:56 +01:00
parent abf4c345f0
commit d8b1e2701c

View File

@ -858,9 +858,6 @@ class TorrentManager(component.Component):
def _save_state(self):
"""Save the state of the TorrentManager to the torrents.state file."""
state = self.create_state()
if not state.torrents:
log.debug('Skipping saving state with no torrents loaded')
return
# If the state hasn't changed, no need to save it
if self.prev_saved_state == state: