Skip to content

Fix/base destination queue init#554

Open
beltradini wants to merge 3 commits into
SwiftyBeaver:masterfrom
beltradini:fix/base-destination-queue-init
Open

Fix/base destination queue init#554
beltradini wants to merge 3 commits into
SwiftyBeaver:masterfrom
beltradini:fix/base-destination-queue-init

Conversation

@beltradini

Copy link
Copy Markdown

This patch ensures BaseDestination.queue is always initialized in init(), removing the possibility of a fatalError("Queue not set") crash when destinations are created concurrently or used immediately after creation. The behavior is maintained (queue remains a private serial queue with .utility QoS) but is now safe in concurrent creation scenarios.

Changes

  • Sources:

    • Sources/BaseDestination.swiftqueue is now non-optional and initialized in init().
    • Sources/SwiftyBeaver.swift — minor adjustments to use dest.queue directly.
  • Tests:

    • Tests/SwiftyBeaverTests/BaseDestinationQueueTests.swift — unit tests for async/sync execution, ordering, and error propagation.
    • Tests/SwiftyBeaverTests/StressTests.swift — added stress/concurrency tests (testConcurrentAsyncNoCrashStress, testMixedSyncAsyncNoDeadlock, testNoFatalErrorUnderRace).
  • CI / Changelog:

    • .github/workflows/ci.yml — runs swift test on macOS and Ubuntu; Linux job will run ./test_in_docker.sh if Docker is available.
    • CHANGELOG.md — added Unreleased entry describing the fix.

Refactors BaseDestination to use a non-optional DispatchQueue, removing related nil checks and potential crashes. Adds new unit and stress tests to verify queue behavior and concurrency safety. Introduces a CI workflow for automated testing on macOS and Ubuntu. Updates CHANGELOG to reflect these changes.
Deleted the checklist, labels, and related notes from the PR_BODY.md template to streamline the pull request body content.
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.

1 participant