Minor fix for queue

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-10-20 02:04:46 +03:00
parent cb601eb8df
commit 89facdd1a3
No known key found for this signature in database
GPG Key ID: EAAC8A2DF2861DE4
3 changed files with 4 additions and 4 deletions

View File

@ -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):

View File

@ -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)
@ -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:

View File

@ -367,7 +367,7 @@ class TaskListener(TaskConfig):
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()
@ -406,7 +406,7 @@ class TaskListener(TaskConfig):
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: