Skip to content

Commit

Permalink
add msg_id is too low
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyThink committed Oct 21, 2023
1 parent 4962cb4 commit 9ec0444
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conf/supervisor_main.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ priority=999

redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stdout_logfile_maxbytes=0
14 changes: 11 additions & 3 deletions ytdlbot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,24 @@ def updates_too_long_detector(self):
]
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())
logging.warning("kick out crash: %s", self.func_name())
return True
logging.debug("No crash detected.")

def next_salt_detector(self):
text = "Next salt in"
if self.logs.count(text) >= 4:
logging.warning("Potential crash detected by %s, it's time to commit suicide...", self.func_name())
logging.warning("Next salt crash: %s", self.func_name())
return True

def msg_id_detector(self):
text = "The msg_id is too low"
if text in self.logs:
logging.warning("msg_id is too low crash: %s ", self.func_name())
for item in pathlib.Path(".").glob("*.session"):
item.unlink(missing_ok=True)
return True

# def idle_detector(self):
# mtime = os.stat("/var/log/ytdl.log").st_mtime
# cur_ts = time.time()
Expand All @@ -202,7 +210,7 @@ def auto_restart():
method_list = [getattr(det, func) for func in dir(det) if func.endswith("_detector")]
for method in method_list:
if method():
logging.critical("Bye bye world!☠️")
logging.critical("%s bye bye world!☠️", method)
for item in pathlib.Path(TMPFILE_PATH or tempfile.gettempdir()).glob("ytdl-*"):
shutil.rmtree(item, ignore_errors=True)

Expand Down

0 comments on commit 9ec0444

Please sign in to comment.