more suicide

This commit is contained in:
BennyThink 2022-03-11 21:30:53 +08:00
parent fcb01bd140
commit 9cbf0133ab
No known key found for this signature in database
GPG Key ID: 6CD0DBDA5235D481
2 changed files with 9 additions and 2 deletions

View File

@ -177,7 +177,14 @@ class Detector:
def updates_too_long_detector(self):
# If you're seeing this, that means you have logged more than 10 device
# and the earliest account was kicked out. Restart the program could get you back in.
indicators = ["types.UpdatesTooLong", "Got shutdown from remote", "Code is updated"]
indicators = [
"types.UpdatesTooLong",
"Got shutdown from remote",
"Code is updated",
'Retrying "messages.GetMessages"',
"OSError: Connection lost",
"[Errno -3] Try again"
]
for indicator in indicators:
if indicator in self.logs:
logging.warning("Potential crash detected by %s, it's time to commit suicide...", self.func_name())

View File

@ -337,7 +337,7 @@ def periodic_sub_check():
if __name__ == '__main__':
MySQL()
scheduler = BackgroundScheduler(timezone="Asia/Shanghai")
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=5)
scheduler.add_job(InfluxDB().collect_data, 'interval', seconds=60)