-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: add signal
option to retry
and parallel
#262
Conversation
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.
Just a few more changes and it should be good :)
Hey! There's a new requirement for PRs that introduce new features. Without this requirement met, we won't be able to merge this. Note that this PR can still be included in a
|
Hi @aleclarson! I’ve updated next-minor.md. When you have a moment, please check it out |
- Avoid function allocations - Stop processing the array upon being aborted - Reject with `signal.reason` just like `signal.throwIfAborted` does
Hey @SaidbekAbdiganiev, thanks for the contribution! I'll merge this now and I hope to release it in v12.3.0 very soon. Hope to see more from you in the future 😃 P.S. I refactored the
|
AbortSignal
options to retry
and parallel
signal
option to retry
and parallel
A stable release To install: pnpm add [email protected] |
Tip
The owner of this PR can publish a preview release by commenting
/publish
in this PR. Afterwards, anyone can try it out by runningpnpm add radashi@pr<PR_NUMBER>
.Summary
This PR adds an option to pass
AbortController.signal
toretry
andparallel
to end their execution before looping over all of the array items, or going through all of the retry attempts. When aborted, the functions throw anError
with the messageOperation aborted
.Related issue, if any:
#255
https://github.com/orgs/radashi-org/discussions/256
For any code change,
Does this PR introduce a breaking change?
Yes
I do not know entirely what are the implications of this change, but I added the
DOM
parameter tolib
intsconfig.json
. According to this article, it adds the types for browser API's which in this case includes theAbortController
. According tocan i use
, it is supported in all major browsers and has been implemented in node since v15, so it shouldn't break any existing applications using older versions of radashi.Bundle impact
src/async/parallel.ts
src/async/retry.ts
Footnotes
Function size includes the
import
dependencies of the function. ↩