mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 13:50:09 +00:00
fix(status): cache Finder probe failures to avoid repeated timeout
This commit is contained in:
@@ -332,6 +332,9 @@ func getFinderStartupDiskFreeBytes() (free, total uint64, err error) {
|
||||
out, err := runCmd(ctx, "osascript", "-e",
|
||||
`tell application "Finder" to return {free space of startup disk, capacity of startup disk}`)
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user