[courier/fetch] detect aborted requests more agressively
This commit is contained in:
parent
8a4992640b
commit
c12f18df27
|
@ -29,22 +29,26 @@ export default function FetchTheseProvider(Private, Promise) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchWithStrategy(strategy, requests) {
|
function fetchWithStrategy(strategy, requests) {
|
||||||
|
function replaceAbortedRequests() {
|
||||||
|
requests = requests.map(r => r.aborted ? ABORTED : r);
|
||||||
|
}
|
||||||
|
|
||||||
requests = requests.map(function (req) {
|
replaceAbortedRequests();
|
||||||
return req.aborted ? ABORTED : req;
|
|
||||||
});
|
|
||||||
|
|
||||||
return startRequests(requests)
|
return startRequests(requests)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
replaceAbortedRequests();
|
||||||
return callClient(strategy, requests);
|
return callClient(strategy, requests);
|
||||||
})
|
})
|
||||||
.then(function (responses) {
|
.then(function (responses) {
|
||||||
|
replaceAbortedRequests();
|
||||||
return callResponseHandlers(requests, responses);
|
return callResponseHandlers(requests, responses);
|
||||||
})
|
})
|
||||||
.then(function (responses) {
|
.then(function (responses) {
|
||||||
|
replaceAbortedRequests();
|
||||||
return continueIncomplete(strategy, requests, responses, fetchWithStrategy);
|
return continueIncomplete(strategy, requests, responses, fetchWithStrategy);
|
||||||
})
|
})
|
||||||
.then(function (responses) {
|
.then(function (responses) {
|
||||||
|
replaceAbortedRequests();
|
||||||
return responses.map(function (resp) {
|
return responses.map(function (resp) {
|
||||||
switch (resp) {
|
switch (resp) {
|
||||||
case ABORTED:
|
case ABORTED:
|
||||||
|
|
Loading…
Reference in a new issue