diff --git a/config/config.json b/config/config.json index 7e4966c..d56aeb5 100644 --- a/config/config.json +++ b/config/config.json @@ -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 diff --git a/douyin/core/douyin_fudai.py b/douyin/core/douyin_fudai.py index bbcd3be..e331599 100644 --- a/douyin/core/douyin_fudai.py +++ b/douyin/core/douyin_fudai.py @@ -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") diff --git a/douyin/fudai/douyin_fudai_core.py b/douyin/fudai/douyin_fudai_core.py index 66348d2..d654e0c 100644 --- a/douyin/fudai/douyin_fudai_core.py +++ b/douyin/fudai/douyin_fudai_core.py @@ -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: