From 3b4293365dbd6a8a1f74af8c0c3456db3572f126 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 18 Jan 2026 15:20:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=9D=E7=95=99=E5=A4=A9=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=EF=BC=9B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E8=AE=B0=E5=BD=95=E6=A3=80=E6=9F=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.json | 14 +++++++------- douyin/core/douyin_fudai.py | 28 ++++++++++++++++++++++++++++ douyin/fudai/douyin_fudai_core.py | 14 ++++++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) 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: