优化: 空闲 CPU 归零,事件驱动渲染+输入等待

This commit is contained in:
2026-06-08 13:35:41 +08:00
parent 80c90e6089
commit 32485c8ea7
3 changed files with 6 additions and 1 deletions

View File

@@ -108,6 +108,10 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.update.Checking = false
case cacheFlushMsg:
m.flushCache()
// 只在仍有脏数据时继续调度,避免空转
if m.cacheDirty {
return m, cacheFlushTick()
}
return m, nil
case tea.QuitMsg:
m.flushCache()