You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Simplify concurrent request error handling
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user