Release 3.8.2.5: cheaper idle UI poll and tighter hot paths.
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run

Delta getState by rev, pause when hidden, cancellable background loops,
hostCache bounds, unlock PollUI around engine status, corebin singleflight,
PingAll worker pool.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
M4
2026-08-01 16:13:59 +03:00
co-authored by Cursor
parent ff5d87ab9f
commit 2ad376b49e
25 changed files with 277 additions and 67 deletions
+16 -2
View File
@@ -3,11 +3,14 @@ package corebin
import (
"strings"
"sync"
"golang.org/x/sync/singleflight"
)
var (
mu sync.Mutex
cache = map[string]string{}
group singleflight.Group
)
// CacheKey identifies a resolved core binary for a binDir + protocol.
@@ -48,15 +51,26 @@ func Invalidate() {
// Resolve caches the result of fn under key.
// Hot-path polls trust the cache until Invalidate (no per-poll os.Stat).
// Embedded/virtual paths never touch the filesystem.
// Concurrent cold misses for the same key share one fn call (singleflight).
func Resolve(key string, fn func() (string, error)) (string, error) {
if path, ok := Get(key); ok {
return path, nil
}
path, err := fn()
v, err, _ := group.Do(key, func() (any, error) {
if path, ok := Get(key); ok {
return path, nil
}
path, err := fn()
if err != nil {
return "", err
}
Set(key, path)
return path, nil
})
if err != nil {
return "", err
}
Set(key, path)
path, _ := v.(string)
return path, nil
}