Uh oh!
There was an error while loading. Please reload this page.
lib: add AbortSignal.timeout - #40899
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
benjamingr
commented
Nov 21, 2021
I am not too happy this makes it hard to determine an error is cancellation |
jasnell
commented
Nov 21, 2021
I don't understand. This sets the reason to a TimeoutError whose stack clearly shows it coming from an AbortSignal. And the code still has to be written to use the reason, which is optional. Can you explain? |
a8362d8 to
f04a7fbComparebenjamingr
commented
Nov 21, 2021
Yes, if I have code that might cancel because of a timeout or any other cancellation before This method adds a new way to timeout an action that rejects with an error that isn't AbortError. I want to make sure users have a clean way to handle this. |
jasnell
commented
Nov 21, 2021
Similar to the |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aab9e13 to
820e505Compare
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
Nov 25, 2021
jasnell
commented
Nov 25, 2021
@targos ... please take another look. I updated the implementation to ensure that the underlying timer would not prevent the AbortSignal from being garbage collected and to unref the timer object so that the timer would not keep the event loop from exiting. |
cf9cb71 to
ed3f0f9Comparetargos
commented
Nov 25, 2021
I'll have a look tomorrow. |
nodejs-github-bot
commented
Nov 29, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Builds on from the AbortSignal.reason PR, which should land first.
whatwg/dom#1032 introduces a new
AbortSignal.timeout()that returns anAbortSignalthat triggers in the given number of milliseconds.