mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-09 04:47:34 +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():
|
async def _jd_listener():
|
||||||
while True:
|
while True:
|
||||||
await sleep(3)
|
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:
|
async with jd_lock:
|
||||||
if len(jd_downloads) == 0:
|
if len(jd_downloads) == 0:
|
||||||
Intervals["jd"] = ""
|
Intervals["jd"] = ""
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
packages = await sync_to_async(
|
packages = await wait_for(
|
||||||
jdownloader.device.downloads.query_packages, [{"finished": True}]
|
sync_to_async(
|
||||||
|
jdownloader.device.downloads.query_packages,
|
||||||
|
[{"finished": True}],
|
||||||
|
), timeout=10
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
|
await sync_to_async(jdownloader.reconnect) or await sync_to_async(
|
||||||
|
jdownloader.jdconnect
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
finished = [
|
finished = [
|
||||||
pack["uuid"] for pack in packages if pack.get("finished", False)
|
pack["uuid"] for pack in packages if pack.get("finished", False)
|
||||||
|
@ -318,9 +318,9 @@ async def sync_jdownloader():
|
|||||||
).wait()
|
).wait()
|
||||||
await DbManager().update_private_file("cfg.zip")
|
await DbManager().update_private_file("cfg.zip")
|
||||||
try:
|
try:
|
||||||
await wait_for(sync_to_async(jdownloader.update_devices), timeout=5)
|
await wait_for(sync_to_async(jdownloader.update_devices), timeout=10)
|
||||||
except:
|
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:
|
if not is_connected:
|
||||||
LOGGER.error(jdownloader.error)
|
LOGGER.error(jdownloader.error)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user