Replies: 2 comments 3 replies
-
I don't want to encourage this pattern because it's technically a violation of the task protocol, which states that a running task must terminate ASAP on cancellation. All combinators wait for their inputs to terminate before terminating the output, therefore a task ignoring cancellation contaminates the rest of the pipeline. The only situation where it's safe to do so is when the promise is guaranteed to be resolved in reasonable time (e.g because the underlying operation has properly set timeouts). I don't mind having a wiki entry about it, but it should be labeled as an expert feature and be very explicit about why it's dangerous, what could go wrong and when it can be used safely. |
Beta Was this translation helpful? Give feedback.
-
Have you seen this Peter from the slack channel:
https://gist.github.com/dustingetz/d3fb5338b43ef86df5f97387f1d5e249#file-await_promise-clj-L34-L43
|
Beta Was this translation helpful? Give feedback.
-
The wiki for task interop uses a dfv with absolve to turn a js promise into a task. Wouldn't
do the same with less ceremony?
I'd also add a note that promises futures etc. can't be represented as fully compliant tasks because they can't be canceled nor waited for cancelation to finish.
Would you agree with these 2 changes in the wiki?
Beta Was this translation helpful? Give feedback.
All reactions