radashi-org / radashi

The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.
https://radashi.js.org
MIT License
314 stars 25 forks source link

Option to prematurely end execution of retry and parallel #255

Closed SaidbekAbdiganiev closed 2 months ago

SaidbekAbdiganiev commented 2 months ago

Currently, there is no way to forcibly terminate execution of retry and parallel functions. This presents a problem in scenarios where:

In such cases, we must wait for all iterations to complete, which can lead to unnecessarily long execution times.

The simplest solution that comes to mind is just to use AbortController, but I'm not sure if this is good enough since AbortController tends to be slow in Node (or at least I heard so). Would you like me to open a PR with an implementation of this feature?