mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
Simplify concurrent request error handling
This commit is contained in:
parent
71c1198d12
commit
2dfb3146b0
1 changed files with 3 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue