Skip to content

fix typo#2

Merged
domzilla merged 1 commit into
domzilla:masterfrom
luizfls:patch-1
Jan 17, 2024
Merged

fix typo#2
domzilla merged 1 commit into
domzilla:masterfrom
luizfls:patch-1

Conversation

@luizfls

@luizfls luizfls commented Jan 5, 2024

Copy link
Copy Markdown

small contrib

@peterklingelhofer

Copy link
Copy Markdown

Came here to fix the same thing. Please merge this @domzilla. :)

@domzilla domzilla merged commit b530419 into domzilla:master Jan 17, 2024
bubbleee030 added a commit to bubbleee030/Caffeine that referenced this pull request May 19, 2026
#1 SleepPreventionManager.refreshAssertions now creates the three new
   assertions before releasing the old IDs, so the kernel always sees at
   least one of each type during a refresh (swap-then-release, not
   release-then-create). The doc comment claimed overlap but the code
   left a microsecond gap. New testRefreshCreatesNewAssertionsBeforeReleasingOld
   pins the ordering via an operationLog on the test fake.

domzilla#2 NSWorkspace session observers now use the Combine publisher API with
   AnyCancellable, so they detach automatically when the manager
   deallocates. The previous selector-based addObserver retained the
   target forever — fine for the production singleton, but every test
   that constructed a SleepPreventionManager(backend:) leaked two
   observers. testManagerDeallocatesWhenOutOfScope proves the leak is
   fixed via a weak ref.

domzilla#3 LaunchAtLoginManager.setEnabled now logs the underlying error via
   os.Logger (subsystem net.domzilla.caffeine, visible in Console.app)
   and surfaces it on a public `lastError` property so the UI layer can
   present it to the user. refresh() still snaps the published isEnabled
   back to the backend truth, so a failed register visually pops the
   Toggle back to off. Two new tests cover lastError set on throw and
   cleared on next success.

domzilla#4 scripts/integration-test.sh replaces the fixed 3 s sleep with a
   poll_for_caffeine_assertions helper that retries pmset every second
   until Caffeine-owned assertions appear (default 30 s timeout,
   overridable via ASSERTION_POLL_TIMEOUT). Avoids flakiness on slow
   runners where SwiftUI initialization takes longer than 3 s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants