mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-07 03:26:46 +08:00
Remove GLOBAL_GID when queue task cancelled
This commit is contained in:
parent
b2060f1f3b
commit
f23ce882ae
@ -60,10 +60,8 @@ class TelegramDownloadHelper:
|
||||
|
||||
async def _on_download_error(self, error):
|
||||
async with global_lock:
|
||||
try:
|
||||
if self._id in GLOBAL_GID:
|
||||
GLOBAL_GID.remove(self._id)
|
||||
except:
|
||||
pass
|
||||
await self._listener.on_download_error(error)
|
||||
|
||||
async def _on_download_complete(self):
|
||||
@ -148,6 +146,9 @@ class TelegramDownloadHelper:
|
||||
await send_status_message(self._listener.message)
|
||||
await event.wait()
|
||||
if self._listener.is_cancelled:
|
||||
async with global_lock:
|
||||
if self._id in GLOBAL_GID:
|
||||
GLOBAL_GID.remove(self._id)
|
||||
return
|
||||
|
||||
await self._on_download_start(gid, add_to_queue)
|
||||
|
Loading…
Reference in New Issue
Block a user