1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 18:30:08 +00:00

fix(status): cache Finder probe failures to avoid repeated timeout

This commit is contained in:
Tw93
2026-03-21 16:06:55 +08:00
parent 4f178c1d7a
commit 68a83c7862

View File

@@ -332,6 +332,9 @@ func getFinderStartupDiskFreeBytes() (free, total uint64, err error) {
out, err := runCmd(ctx, "osascript", "-e", out, err := runCmd(ctx, "osascript", "-e",
`tell application "Finder" to return {free space of startup disk, capacity of startup disk}`) `tell application "Finder" to return {free space of startup disk, capacity of startup disk}`)
if err != nil { if err != nil {
// Cache the failure timestamp so repeated calls within diskCacheTTL
// return immediately instead of each waiting the full 5s timeout.
finderDiskCachedAt = time.Now()
return 0, 0, err return 0, 0, err
} }