-
-
Notifications
You must be signed in to change notification settings - Fork 12
Create Task API -> 0.7.0 #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
d261c62
to
c5297ef
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 11 10 -1
Lines 1060 1119 +59
=========================================
+ Hits 1060 1119 +59
🚀 New features to boost your workflow:
|
5e2c2f4
to
0df8eac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 11 changed files in this pull request and generated no comments.
Files not reviewed (9)
- Sources/AsyncQueue/ActorQueue.swift: Language not supported
- Sources/AsyncQueue/FIFOQueue.swift: Language not supported
- Sources/AsyncQueue/MainActorQueue.swift: Language not supported
- Sources/AsyncQueue/Utilities/Delivery.swift: Language not supported
- Sources/AsyncQueue/Utilities/Semaphore.swift: Language not supported
- Tests/AsyncQueueTests/ActorQueueTests.swift: Language not supported
- Tests/AsyncQueueTests/FIFOQueueTests.swift: Language not supported
- Tests/AsyncQueueTests/MainActorQueueTests.swift: Language not supported
- Tests/AsyncQueueTests/SemaphoreTests.swift: Language not supported
Comments suppressed due to low confidence (1)
README.md:104
- The migration instructions specify using the 'isolatedTo' parameter when enqueuing tasks on an actor; consider changing this to 'await Task(on: queue, isolatedTo: myself) { myself in' to fully adhere to the new API.
await Task(on: queue) { myself in
dfed
commented
Apr 8, 2025
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.
Addresses #50
This PR represents a breaking change of the API. In this PR, we:
.enqueue
(and similar) API on bothFIFOQueue
andActorQueue
with aTask
-based API. Now operations can be enqueued on these queues withTask(on: queue)
. By creating aTask
, we now allow consumers to cancel pending tasks.MainActorQueue
entirely, and replaced it withTask(on: MainActor.queue)
The good news is that migration is quite straightforward.
queue.enqueue { … }
withTask(on: queue) { … }
await queue.enqueueAndWait { … }
withawait Task(on: queue) { … }.value
try await queue.enqueueAndWait { … }
withtry await Task(on: queue) { … }.value
try await queue.enqueueAndWait { … }
withawait Task(on: queue) { … }.value
queue.enqueue(on: someActor) { someActor in … }
withTask(on: queue, isolatedTo: someActor) { someActor in … }
MainActorQueue.shared.enqueue { … }
withTask(on: MainActor.queue) { … }
These changes enable consumers to store and cancel enqueued tasks.