cleanup: remove dead refreshOutdatedList and unused lastOutdatedFetch
refreshOutdatedList (the 5-second cache path) was never called by any menu item or code path, so the cache logic never ran. lastOutdatedFetch was only written. cachedOutdated stays: the Upgrade All confirmation dialog uses it to list pending packages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
e47455b3f8
commit
d1f4c0cb79
|
|
@ -35,9 +35,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ cache to prevent duplicate outdated calls
|
/// last known outdated list, shown in the Upgrade All confirmation
|
||||||
var cachedOutdated: [String] = []
|
var cachedOutdated: [String] = []
|
||||||
var lastOutdatedFetch: Date?
|
|
||||||
|
|
||||||
// MARK: - Menu
|
// MARK: - Menu
|
||||||
|
|
||||||
|
|
@ -272,17 +271,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
return alert.runModal() == .alertFirstButtonReturn
|
return alert.runModal() == .alertFirstButtonReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ✅ SMART refresh (uses cache)
|
|
||||||
@objc func refreshOutdatedList() {
|
|
||||||
// if fetched in last 5s → uses cache
|
|
||||||
if let last = lastOutdatedFetch, Date().timeIntervalSince(last) < 5 {
|
|
||||||
updateOutdatedMenu(with: cachedOutdated)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchOutdated()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ✅ FORCE refresh (menu button)
|
/// ✅ FORCE refresh (menu button)
|
||||||
@objc func forceRefreshOutdated() {
|
@objc func forceRefreshOutdated() {
|
||||||
fetchOutdated()
|
fetchOutdated()
|
||||||
|
|
@ -295,7 +283,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
let lines = BrewParser.parseOutdated(output)
|
let lines = BrewParser.parseOutdated(output)
|
||||||
|
|
||||||
self.cachedOutdated = lines
|
self.cachedOutdated = lines
|
||||||
self.lastOutdatedFetch = Date()
|
|
||||||
|
|
||||||
self.updateOutdatedMenu(with: lines)
|
self.updateOutdatedMenu(with: lines)
|
||||||
self.updateStatus(count: lines.count)
|
self.updateStatus(count: lines.count)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue