Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean torrent_states on torrent remove event #3

Open
laur89 opened this issue Jan 23, 2022 · 0 comments
Open

clean torrent_states on torrent remove event #3

laur89 opened this issue Jan 23, 2022 · 0 comments

Comments

@laur89
Copy link
Owner

laur89 commented Jan 23, 2022

Otherwise the state file will continue growing indefinitely.
Note atm we do clean it up if ARP itself removes the torrent, but not in cases where torrent deletion is triggered by 3rd party.
We should remove current deletion (del self.torrent_states.config[tid] in remove_torrent()) and instead register a torrent removed event handler, eg what LabelPlus plugin does:

    deluge.component.get("EventManager").register_event_handler(
      "PreTorrentRemovedEvent", self.on_torrent_removed)


  def on_torrent_removed(self, torrent_id):

    if torrent_id in self._mappings:
      label_id = self._mappings[torrent_id]
      self._remove_torrent_label(torrent_id)
      log.debug("Removing torrent %r from label %r", torrent_id, label_id)

    self._timestamp["mappings_changed"] = datetime.datetime.now()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant