♻️ Back to v1.4.10

Use new connection method
This commit is contained in:
xtaodada 2024-03-23 22:38:53 +08:00
parent 020dc1c4a8
commit 7cb481d0fc
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 4 additions and 37 deletions

View File

@ -22,8 +22,8 @@ from pagermaid.scheduler import scheduler
import pyromod.listen
from pyrogram import Client
pgm_version = "1.4.13"
pgm_version_code = 1413
pgm_version = "1.4.10"
pgm_version_code = 1410
CMD_LIST = {}
module_dir = __path__[0]
working_dir = getcwd()

View File

@ -1,16 +1,10 @@
import asyncio
from pyrogram.raw.functions import PingDelayDisconnect
from pagermaid import read_context, logs
from pagermaid import read_context
from pagermaid.common.reload import reload_all
from pagermaid.enums import Message
from pagermaid.listener import listener
from pagermaid.services import bot, scheduler
from pagermaid.services import scheduler
from pagermaid.utils import lang
ping_watchdog_event = asyncio.Event()
@listener(
is_plugin=False, command="reload", need_admin=True, description=lang("reload_des")
@ -24,30 +18,3 @@ async def reload_plugins(message: Message):
@scheduler.scheduled_job("cron", hour="4", id="reload.clear_read_context")
async def clear_read_context_cron():
read_context.clear()
@scheduler.scheduled_job("interval", seconds=10, id="reload.ping_watchdog")
async def ping_task():
if not bot.session.is_started.is_set():
logs.debug("Ping task bot not started, skip")
return
if ping_watchdog_event.is_set():
logs.debug("Ping task watchdog event set, skip")
return
logs.debug("Ping task running")
try:
await bot.session.invoke(
PingDelayDisconnect(
ping_id=0,
disconnect_delay=bot.session.WAIT_TIMEOUT + 10,
),
retries=0,
)
except OSError:
logs.debug("Ping task raise OSError, try restart")
ping_watchdog_event.set()
try:
await bot.session.restart()
finally:
ping_watchdog_event.clear()
logs.debug("Ping task ok")