Skip to content

Commit

Permalink
Minor fix for queue
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Oct 19, 2024
1 parent cb601eb commit 89facdd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion bot/helper/ext_utils/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ async def start_from_queued():
f_tasks = all_limit - all_
if queued_up and (not up_limit or up < up_limit):
for index, mid in enumerate(list(queued_up.keys()), start=1):
f_tasks = all_limit - all_
await start_up_from_queued(mid)
f_tasks -= 1
if f_tasks == 0 or (up_limit and index >= up_limit - up):
Expand Down
3 changes: 2 additions & 1 deletion bot/helper/listeners/aria2_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ async def _on_download_started(api, gid):
LOGGER.info(f"onDownloadStarted: {download.name} - Gid: {gid}")
await sleep(1)

await sleep(2)
if task := await get_task_by_gid(gid):
download = await sync_to_async(api.get_download, gid)
await sleep(2)
await sync_to_async(download.update)
task.listener.name = download.name
msg, button = await stop_duplicate_check(task.listener)
Expand Down Expand Up @@ -158,6 +158,7 @@ async def _on_download_stopped(_, gid):

@loop_thread
async def _on_download_error(api, gid):
await sleep(1)
LOGGER.info(f"onDownloadError: {gid}")
error = "None"
try:
Expand Down
4 changes: 2 additions & 2 deletions bot/helper/listeners/task_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ async def on_download_error(self, error, button=None):
del task_dict[self.mid]
count = len(task_dict)
await self.remove_from_same_dir()
msg = f"{self.tag} Download: {escape(error)}"
msg = f"{self.tag} Download: {escape(str(error))}"
await send_message(self.message, msg, button)
if count == 0:
await self.clean()
Expand Down Expand Up @@ -406,7 +406,7 @@ async def on_upload_error(self, error):
if self.mid in task_dict:
del task_dict[self.mid]
count = len(task_dict)
await send_message(self.message, f"{self.tag} {escape(error)}")
await send_message(self.message, f"{self.tag} {escape(str(error))}")
if count == 0:
await self.clean()
else:
Expand Down

0 comments on commit 89facdd

Please sign in to comment.