Replies: 2 comments 8 replies
-
Hmmm. There is a test that attempts to validate this exact thing, and it passes. These kinds of things can be racy though. Could it be the test is wrong? Or perhaps your code is actually being canceled after the check is performed? Queue/Tests/QueueTests/AsyncQueueTests.swift Line 209 in cc86ecf |
Beta Was this translation helpful? Give feedback.
3 replies
-
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to wrap my head around this.
From some async code, I'm enqueing a task onto a queue:
If the outer task gets cancelled, the inner task doesn't get cancelled too—there's no parent-child relationship.
Would propagating cancellation be achievable?
And would it be a good idea at all? (i.e. does my need to propagate cancellation suggest I'd be better served by something other than a queue)
The queue is used to make sure a given Web resource is only being written to by a single operation at a time. Or, in other words, my enqueing is not fire-and-forget; the tasks are kept track of, surfaced in the app's UI, and the user can elect to cancel them.
Beta Was this translation helpful? Give feedback.
All reactions