优化: 空闲 CPU 归零,事件驱动渲染+输入等待
This commit is contained in:
1 parent
80c90e6089
commit
32485c8ea7
3 files changed
+6
-1
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user