Repository navigation
fix: 循环时间设置运行中修改后生效 (#469, #309) - #517
Open
zzuu080603 wants to merge 1 commit into
Open
zzuu080603 wants to merge 1 commit into
zzuu080603 wants to merge 1 commit into
Conversation
…ply (ihmily#469, ihmily#309) The periodic live-check task captured the loop-time interval in its closure at startup, and the _periodic_task_running guard prevented the task from being recreated after settings changed. Users lowering the loop time (e.g. 30s) kept getting the startup value (default 300s), so stream starts were detected minutes late. The interval is now re-read from user_config on every cycle; invalid values fall back to 300 and zero/negative values clamp to 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因
periodic_check后台任务的检测间隔在启动时被闭包捕获(asyncio.sleep(interval)),且_periodic_task_running类级守卫阻止任务重建。用户在设置中把循环时间改成 30 秒后:initialize_dynamic_state()确实更新了record_manager.loop_time_seconds和所有recording.loop_time_seconds这正好解释 #469 的现象:用户设 30 秒,录制开头缺失 3 分钟以上(实际间隔 ≈ 300 秒 = 5 分钟)。#309 为同一问题的更早报告。
修复
新增
_get_loop_interval(),每个周期从user_config重新读取间隔:配置修改(
settings_view已调用initialize_dynamic_state)在下一个周期立即生效,无需重启。异常值容错:None/非法字符串回退 300,0/负数夹到最小 1。验证(单元测试,加载真实源码驱动 periodic_check)
loop_time_seconds从 300 改为 30:追踪asyncio.sleep参数序列为[300, 300, 30, 30]—— 改配置后下一周期立即使用新值 ✅check_live_on_browser_refresh为 False 的分支同样动态生效 ✅30→30、None→300、'abc'→300、0→1、-5→1✅Fixes #469
Fixes #309