mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-08 12:07:33 +08:00
Trying to handle jdownloader timeout
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
parent
ab32b862d7
commit
612bc4f2cf
@ -33,20 +33,21 @@ async def _onDownloadComplete(gid):
|
||||
async def _jd_listener():
|
||||
while True:
|
||||
await sleep(3)
|
||||
try:
|
||||
await wait_for(sync_to_async(jdownloader.update_devices), timeout=5)
|
||||
except:
|
||||
await sync_to_async(jdownloader.jdconnect)
|
||||
continue
|
||||
async with jd_lock:
|
||||
if len(jd_downloads) == 0:
|
||||
Intervals["jd"] = ""
|
||||
break
|
||||
try:
|
||||
packages = await sync_to_async(
|
||||
jdownloader.device.downloads.query_packages, [{"finished": True}]
|
||||
packages = await wait_for(
|
||||
sync_to_async(
|
||||
jdownloader.device.downloads.query_packages,
|
||||
[{"finished": True}],
|
||||
), timeout=10
|
||||
)
|
||||
except:
|
||||
await sync_to_async(jdownloader.reconnect) or await sync_to_async(
|
||||
jdownloader.jdconnect
|
||||
)
|
||||
continue
|
||||
finished = [
|
||||
pack["uuid"] for pack in packages if pack.get("finished", False)
|
||||
|
@ -318,9 +318,9 @@ async def sync_jdownloader():
|
||||
).wait()
|
||||
await DbManager().update_private_file("cfg.zip")
|
||||
try:
|
||||
await wait_for(sync_to_async(jdownloader.update_devices), timeout=5)
|
||||
await wait_for(sync_to_async(jdownloader.update_devices), timeout=10)
|
||||
except:
|
||||
is_connected = await sync_to_async(jdownloader.jdconnect)
|
||||
is_connected = await sync_to_async(jdownloader.reconnect) or await sync_to_async(jdownloader.jdconnect)
|
||||
if not is_connected:
|
||||
LOGGER.error(jdownloader.error)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user