From d1f4c0cb7969f5223da0f648603b30c1ad2040f6 Mon Sep 17 00:00:00 2001 From: maxsoch Date: Mon, 6 Jul 2026 21:30:12 +0200 Subject: [PATCH] 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 --- BrewBar/BrewBarApp.swift | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/BrewBar/BrewBarApp.swift b/BrewBar/BrewBarApp.swift index 793e41f..be2a4fd 100644 --- a/BrewBar/BrewBarApp.swift +++ b/BrewBar/BrewBarApp.swift @@ -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 lastOutdatedFetch: Date? // MARK: - Menu @@ -272,17 +271,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { 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) @objc func forceRefreshOutdated() { fetchOutdated() @@ -295,7 +283,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { let lines = BrewParser.parseOutdated(output) self.cachedOutdated = lines - self.lastOutdatedFetch = Date() self.updateOutdatedMenu(with: lines) self.updateStatus(count: lines.count)