Skip to content

Commit

Permalink
fix(log): wrong watchdog feeding mechanism
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Nov 6, 2023
1 parent 71e8efb commit c45f164
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def shutdown(prerequisite: Awaitable = None):


class _Watchdog:
def __init__(self, delay: int = 5 * 60):
def __init__(self, delay: int = 10 * 60):
self._watchdog = env.loop.call_later(delay, self._exit_bot, delay)

@staticmethod
Expand All @@ -65,7 +65,7 @@ def _exit_bot(delay):
coro = env.loop.create_task(env.bot.send_message(env.MANAGER, f'WATCHDOG: {msg}'))
shutdown(prerequisite=coro)

def fine(self, delay: int = 15 * 60):
def feed(self, delay: int = 15 * 60):
self._watchdog.cancel()
self._watchdog = env.loop.call_later(delay, self._exit_bot, delay)

Expand Down Expand Up @@ -97,10 +97,10 @@ def filter(self, record: logging.LogRecord) -> bool:
env.loop.create_task(coro)
return True
if ' executed successfully' in msg:
self.count = 0
self.watchdog.fine()
return False
if 'Running job "run_monitor_task' in msg:
self.count = 0
self.watchdog.feed()
return False
return True

Expand Down

0 comments on commit c45f164

Please sign in to comment.