Fix/base destination queue init#554
Open
beltradini wants to merge 3 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch ensures
BaseDestination.queueis always initialized ininit(), removing the possibility of afatalError("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.utilityQoS) but is now safe in concurrent creation scenarios.Changes
Sources:
Sources/BaseDestination.swift—queueis now non-optional and initialized ininit().Sources/SwiftyBeaver.swift— minor adjustments to usedest.queuedirectly.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— runsswift teston macOS and Ubuntu; Linux job will run./test_in_docker.shif Docker is available.CHANGELOG.md— addedUnreleasedentry describing the fix.