From 61c02be8e1b77f83801bfb7e5ffb5bc6b90d4503 Mon Sep 17 00:00:00 2001 From: Benny Date: Sat, 8 Apr 2023 16:29:39 +0200 Subject: [PATCH] extend auto restart time --- ytdlbot/tasks.py | 2 +- ytdlbot/utils.py | 2 +- ytdlbot/ytdl_bot.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ytdlbot/tasks.py b/ytdlbot/tasks.py index e8a8d4e..0f763f5 100644 --- a/ytdlbot/tasks.py +++ b/ytdlbot/tasks.py @@ -468,7 +468,7 @@ if __name__ == "__main__": threading.Thread(target=run_celery, daemon=True).start() scheduler = BackgroundScheduler(timezone="Asia/Shanghai") - scheduler.add_job(auto_restart, "interval", seconds=10) + scheduler.add_job(auto_restart, "interval", seconds=900) scheduler.start() idle() diff --git a/ytdlbot/utils.py b/ytdlbot/utils.py index a1c2b1b..3f4f479 100644 --- a/ytdlbot/utils.py +++ b/ytdlbot/utils.py @@ -185,7 +185,7 @@ class Detector: def idle_detector(self): mtime = os.stat("/var/log/ytdl.log").st_mtime cur_ts = time.time() - if cur_ts - mtime > 1800: + if cur_ts - mtime > 7200: logging.warning("Potential crash detected by %s, it's time to commit suicide...", self.func_name()) return True diff --git a/ytdlbot/ytdl_bot.py b/ytdlbot/ytdl_bot.py index 0aa46f9..c45c627 100644 --- a/ytdlbot/ytdl_bot.py +++ b/ytdlbot/ytdl_bot.py @@ -463,7 +463,7 @@ if __name__ == "__main__": MySQL() scheduler = BackgroundScheduler(timezone="Asia/Shanghai", job_defaults={"max_instances": 5}) scheduler.add_job(redis.reset_today, "cron", hour=0, minute=0) - scheduler.add_job(auto_restart, "interval", seconds=60) + scheduler.add_job(auto_restart, "interval", seconds=600) scheduler.add_job(clean_tempfile, "interval", seconds=60) scheduler.add_job(InfluxDB().collect_data, "interval", seconds=60) # default quota allocation of 10,000 units per day