mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-08 12:07:33 +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 def _on_download_error(self, error):
|
||||||
async with global_lock:
|
async with global_lock:
|
||||||
try:
|
if self._id in GLOBAL_GID:
|
||||||
GLOBAL_GID.remove(self._id)
|
GLOBAL_GID.remove(self._id)
|
||||||
except:
|
|
||||||
pass
|
|
||||||
await self._listener.on_download_error(error)
|
await self._listener.on_download_error(error)
|
||||||
|
|
||||||
async def _on_download_complete(self):
|
async def _on_download_complete(self):
|
||||||
@ -148,6 +146,9 @@ class TelegramDownloadHelper:
|
|||||||
await send_status_message(self._listener.message)
|
await send_status_message(self._listener.message)
|
||||||
await event.wait()
|
await event.wait()
|
||||||
if self._listener.is_cancelled:
|
if self._listener.is_cancelled:
|
||||||
|
async with global_lock:
|
||||||
|
if self._id in GLOBAL_GID:
|
||||||
|
GLOBAL_GID.remove(self._id)
|
||||||
return
|
return
|
||||||
|
|
||||||
await self._on_download_start(gid, add_to_queue)
|
await self._on_download_start(gid, add_to_queue)
|
||||||
|
Loading…
Reference in New Issue
Block a user