Skip to content
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

Create an AnxApi.map function capable of canceling requests on first fail #63

Open
tsantef opened this issue May 22, 2017 · 1 comment

Comments

@tsantef
Copy link
Member

tsantef commented May 22, 2017

Currently when currency limiting is enabled and a request fails there is no way to tell other related requests to cancel. I'm proposing a new shared map function that will allow requests to be grouped and cancelable as a unit.

@chrisdopuch
Copy link

Looks like there is a way to cancel an axios request using a cancel token
https://github.com/mzabriskie/axios#cancellation

The map function could receive an array of request objects and then call self._request on each of them with the additional cancelToken option. In the catch block of the promise.all you could then .cancel on each of the other promises. Or the map function could return a promise which in turn has a .cancel function that when called .cancels all of the request promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants