优化:调整日志保留天数和压缩设置,增强日志管理;添加预约记录检查逻辑,避免直播间循环
This commit is contained in:
1 parent
191edf9f28
commit
3b4293365d
3 files changed
+49
-7
No files matched your search
+7
-7
@@ -146,7 +146,7 @@
|
||||
"logging": {
|
||||
"level": "DEBUG",
|
||||
"file_path": "logs/unified.log",
|
||||
"keep_days": 3,
|
||||
"keep_days": 1,
|
||||
"use_dated_logs": true,
|
||||
"rotation": {
|
||||
"enabled": true,
|
||||
@@ -185,18 +185,18 @@
|
||||
]
|
||||
},
|
||||
"compress_logs": true,
|
||||
"max_total_size_gb": 0.5,
|
||||
"compress_after_days": 2,
|
||||
"max_total_size_gb": 0.2,
|
||||
"compress_after_days": 1,
|
||||
"max_bytes": 104857600,
|
||||
"backup_count": 10,
|
||||
"enable_monitor": true,
|
||||
"monitor_warning_mb": 500.0,
|
||||
"monitor_critical_mb": 60.0
|
||||
"monitor_warning_mb": 60.0,
|
||||
"monitor_critical_mb": 200.0
|
||||
},
|
||||
"debug_captures": {
|
||||
"enabled": false,
|
||||
"keep_days": 3,
|
||||
"max_files": 2000,
|
||||
"keep_days": 1,
|
||||
"max_files": 1000,
|
||||
"auto_cleanup": true,
|
||||
"async_save": false,
|
||||
"log_on_complete": false
|
||||
|
||||
@@ -1971,6 +1971,34 @@ class fudai_analyse:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 检查是否刚刚记录了预约,如果是,强制切换直播间,避免在同一直播间循环
|
||||
try:
|
||||
just_recorded = getattr(self, "_just_recorded_reservation", False)
|
||||
if just_recorded:
|
||||
self._just_recorded_reservation = False # 清除标志
|
||||
try:
|
||||
needswitch = bool(getattr(self, "needswitch", True))
|
||||
except Exception:
|
||||
needswitch = True
|
||||
if needswitch:
|
||||
try:
|
||||
self._log_kv(
|
||||
"预约",
|
||||
"[预约] 刚刚记录预约,强制切换直播间避免循环",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
self.swipe_up_to_next_live()
|
||||
elapsed = time.time() - start_time
|
||||
self._log_kv(
|
||||
"流程",
|
||||
"run_once_basic完成(强制切换直播间)",
|
||||
elapsed_seconds=round(elapsed, 2),
|
||||
)
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 预约检查耗时记录
|
||||
reservation_elapsed = time.time() - reservation_check_start
|
||||
self._log_kv("预约", f"预约检查完成,耗时: {reservation_elapsed:.3f}s")
|
||||
|
||||
@@ -5854,6 +5854,14 @@ def basic_join_decision(
|
||||
# 设置标志表示预约已更新,后续决策会考虑这个信息
|
||||
reservation_updated = True
|
||||
|
||||
# 即使更新预约,也设置标志强制切换,避免循环
|
||||
try:
|
||||
analyser._just_recorded_reservation = True
|
||||
except Exception:
|
||||
pass
|
||||
# 更新预约后返回False,触发切换直播间
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
try:
|
||||
analyser._log_kv(
|
||||
@@ -6161,6 +6169,12 @@ def basic_join_decision(
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 设置标志,强制下次 run_once_basic 切换直播间,避免在同一直播间循环
|
||||
try:
|
||||
analyser._just_recorded_reservation = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 记录预约后返回False,触发切换直播间继续找别的福袋
|
||||
return False
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user