feat: 添加多个日志文件以记录应用程序的运行信息和错误

This commit is contained in:
晓丰 2025-07-04 21:06:50 +08:00
parent 9d7a792937
commit 6329f3e39d

6
DB.py
View File

@ -412,7 +412,7 @@ class DBVidcon:
self.flush()
@mysql_retry()
def update_fight_record_status(self, ids: list[int], report_id: int, new_status: int, errinfo: str = "",
def update_fight_record_status(self, ids, report_id: int, new_status: int, errinfo: str = "",
report_time: int = 0, subsequent_status: int = 1, mid=0):
if not ids:
return # 空列表直接返回
@ -786,7 +786,7 @@ class DBSA:
except Exception as e:
err_no = getattr(e.orig, "args", [None])[0]
if err_no == cls.DEADLOCK_ERRNO and attempt < cls.MAX_SQL_RETRY - 1:
sleep(cls.SQL_RETRY_BASE_SLEEP * (attempt + 1))
time.sleep(cls.SQL_RETRY_BASE_SLEEP * (attempt + 1))
logger.warning("[%s] 死锁重试 %d/%d",
desc, attempt + 1, cls.MAX_SQL_RETRY)
continue
@ -802,7 +802,7 @@ class DBSA:
except Exception as e:
logger.error("[flush] 第 %d 轮失败: %s", round_no, e)
if round_no < cls.FLUSH_RETRY:
sleep(cls.DELAY_ON_FAIL)
time.sleep(cls.DELAY_ON_FAIL)
logger.info("[flush] 等待 %ds 后重试…", cls.DELAY_ON_FAIL)
else:
logger.error("[flush] 连续 %d 轮失败,退回 Redis", cls.FLUSH_RETRY)