From 7d19f9e29c023414ef6ecacbf0b3b24211b9af7b Mon Sep 17 00:00:00 2001 From: Junyan Qin <1010553892@qq.com> Date: Fri, 13 Oct 2023 09:15:37 +0000 Subject: [PATCH] feat: make heartbeat out-of-order (#24) --- free_one_api/impls/watchdog/tasks/heartbeat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/free_one_api/impls/watchdog/tasks/heartbeat.py b/free_one_api/impls/watchdog/tasks/heartbeat.py index d13b80f..70927dc 100644 --- a/free_one_api/impls/watchdog/tasks/heartbeat.py +++ b/free_one_api/impls/watchdog/tasks/heartbeat.py @@ -19,7 +19,7 @@ def __init__(self, chan: chanmgr.AbsChannelManager, cfg: dict): self.channel = chan self.cfg = cfg - self.delay = 10 + self.delay = 5 self.interval = cfg['interval'] async def trigger(self): @@ -30,7 +30,7 @@ async def trigger(self): for chan in self.channel.channels: if chan.enabled: async def process(ch: channel.Channel): - random_delay = random.randint(0, 10) + random_delay = random.randint(0, 30) await asyncio.sleep(random_delay) fail_count = await ch.heartbeat(timeout=self.cfg["timeout"])