mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-07 03:26:46 +08:00
Minor fix for queue
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
parent
cb601eb8df
commit
89facdd1a3
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user