Simplify concurrent request error handling

This commit is contained in:
Luke Barnard 2018-05-02 10:39:15 +01:00
parent 71c1198d12
commit 2dfb3146b0

View file

@ -56,22 +56,16 @@ async function limitConcurrency(fn) {
});
}
let result;
let error;
ongoingRequestCount++;
try {
result = await fn();
return await fn();
} catch (err) {
error = err;
// We explicitly do not handle the error here, but let it propogate.
throw err;
} finally {
ongoingRequestCount--;
checkBacklog();
}
if (error) throw error;
return result;
}
/**