-
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Labels
Description
Is your feature request related to a problem? Please describe.
The app I'm building can fire multiple requests at once.
When one of the requests gets a 401 for an expired token, it updates the token in a RetryPolicy
.
During this update, all other requests should be paused as a new token is being retrieved.
Describe the solution you'd like
Be able to pause requests in the queue, and resume them. For example pausing the queue when a new token is being retrieved.
After the token is updated, all requests in the queue should have their interceptRequest
method called, so the request can be updated with the new token (if an old token is in the request).
An alternative would be that everything runs in a sequence, no simultaneous requests.
- Request 1: Added to queue
- Request 1:
interceptRequest
- Request 2: Added to queue
- Request 1: 401 =>
RetryPolicy
+ pause all requests in the queue - Request 1: Asynchronously finish
shouldAttemptRetryOnResponse
(token in storage updated) - Request 1: Retry so >
interceptRequest
- Request 1: finish successfully
- Request 2:
interceptRequest
- Request 2: finish successfully
- ...