mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-17 03:56:45 +00:00
Fix menubar blocking system sleep and sync tab strip with detail view (#270)
Some checks are pending
CI / semgrep (push) Waiting to run
Some checks are pending
CI / semgrep (push) Waiting to run
Drop .userInitiated from the process activity so macOS can enter deep sleep while the menubar is running. The wake observer already re-syncs on resume. Run the all-provider and per-provider refreshes in parallel in the loop tick so tab strip costs and the detail view update together instead of the detail lagging behind by one CLI call.
This commit is contained in:
parent
04aeda71b6
commit
e22cd158a8
1 changed files with 7 additions and 4 deletions
|
|
@ -59,8 +59,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
|
|||
ProcessInfo.processInfo.automaticTerminationSupportEnabled = false
|
||||
ProcessInfo.processInfo.disableSuddenTermination()
|
||||
backgroundActivity = ProcessInfo.processInfo.beginActivity(
|
||||
options: [.userInitiated, .automaticTerminationDisabled, .suddenTerminationDisabled],
|
||||
reason: "CodeBurn menubar polls AI coding cost every 30 seconds while idle in the background."
|
||||
options: [.automaticTerminationDisabled, .suddenTerminationDisabled],
|
||||
reason: "CodeBurn menubar background refresh"
|
||||
)
|
||||
|
||||
restorePersistedCurrency()
|
||||
|
|
@ -271,9 +271,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
|
|||
let sinceLast = Date().timeIntervalSince(self.lastRefreshTime)
|
||||
if sinceLast >= 5 {
|
||||
if self.store.selectedPeriod != .today || self.store.selectedProvider != .all {
|
||||
await self.store.refreshQuietly(period: .today)
|
||||
async let quiet: Void = self.store.refreshQuietly(period: .today)
|
||||
async let main: Void = self.store.refresh(includeOptimize: false, force: true)
|
||||
_ = await (quiet, main)
|
||||
} else {
|
||||
await self.store.refresh(includeOptimize: false, force: true)
|
||||
}
|
||||
await self.store.refresh(includeOptimize: false, force: true)
|
||||
self.lastRefreshTime = Date()
|
||||
self.refreshStatusButton()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue