stop tracker tasks on shutdown

This commit is contained in:
Victor Shyba 2022-03-08 17:40:53 -03:00
parent 47e432b4bb
commit 42fd1c962e
2 changed files with 4 additions and 1 deletions

View file

@ -750,3 +750,4 @@ class TrackerAnnouncerComponent(Component):
if self.announce_task and not self.announce_task.done(): if self.announce_task and not self.announce_task.done():
self.announce_task.cancel() self.announce_task.cancel()
self.announce_task = None self.announce_task = None
self.tracker_client.stop()

View file

@ -5,7 +5,7 @@ import logging
import time import time
from collections import namedtuple from collections import namedtuple
from lbry.utils import resolve_host, async_timed_cache from lbry.utils import resolve_host, async_timed_cache, cancel_tasks
from lbry.wallet.stream import StreamController from lbry.wallet.stream import StreamController
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -145,6 +145,8 @@ class TrackerClient:
self.client = None self.client = None
self.transport = None self.transport = None
self.EVENT_CONTROLLER.close() self.EVENT_CONTROLLER.close()
cancel_tasks([task for _, task in self.tasks])
self.tasks.clear()
def hash_done(self, info_hash): def hash_done(self, info_hash):
self.announced += 1 self.announced += 1