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:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user