Skip to content

Commit

Permalink
Add a constant for start task name
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovsky committed Sep 8, 2022
1 parent ac08f67 commit d10f724
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def encode_atp(atp):


class DownloadManager(TaskManager):
START_TASK = "start"

def __init__(self,
state_dir,
Expand Down Expand Up @@ -166,7 +167,7 @@ def initialize(self):
self.set_download_states_callback(self.sesscb_states_callback)

def start(self):
self.register_task("start", self._start)
self.register_task(self.START_TASK, self._start)

async def _start(self):
await self.load_checkpoints()
Expand All @@ -180,7 +181,7 @@ def notify_shutdown_state(self, state):
self.notifier[notifications.tribler_shutdown_state](state)

async def shutdown(self, timeout=30):
self.cancel_pending_task("start")
self.cancel_pending_task(self.START_TASK)
self.cancel_pending_task("download_states_lc")
if self.downloads:
self.notify_shutdown_state("Checkpointing Downloads...")
Expand Down

0 comments on commit d10f724

Please sign in to comment.