From 70b093934cba4980ed2fbfb2f934150b6f98add7 Mon Sep 17 00:00:00 2001 From: Junyan Qin <1010553892@qq.com> Date: Mon, 16 Oct 2023 14:03:02 +0000 Subject: [PATCH] feat: set fail_count to 0 after auto-disabling --- free_one_api/impls/watchdog/tasks/heartbeat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/free_one_api/impls/watchdog/tasks/heartbeat.py b/free_one_api/impls/watchdog/tasks/heartbeat.py index 83bde11..46cb106 100644 --- a/free_one_api/impls/watchdog/tasks/heartbeat.py +++ b/free_one_api/impls/watchdog/tasks/heartbeat.py @@ -37,6 +37,7 @@ async def process(ch: channel.Channel): if fail_count >= self.cfg["fail_limit"]: try: await self.channel.disable_channel(ch.id) + ch.fail_count = 0 logging.info(f"Disabled channel {ch.id} due to heartbeat failed {fail_count} times") except Exception: logging.warn(f"Failed to disable channel {ch.id}, traceback: {traceback.format_exc()}")