1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Stop a failed /keys/claim request getting stuck

Putting the new request inside a `finally` block meant we would never actually
transition the promise chain from failure to success. Sticking a no-op `catch`
in the chain makes sure that we can recover from an error.
This commit is contained in:
Richard van der Hoff
2023-03-09 10:51:19 +00:00
parent 97f21b6635
commit f4b83e1a27

View File

@@ -54,7 +54,12 @@ export class KeyClaimManager {
// The Rust-SDK requires that we only have one getMissingSessions process in flight at once. This little dance
// ensures that, by only having one call to ensureSessionsForUsersInner active at once (and making them
// queue up in order).
const prom = this.currentClaimPromise.finally(() => this.ensureSessionsForUsersInner(userList));
const prom = this.currentClaimPromise
.catch(() => {
// any errors in the previous claim will have been reported already, so there is nothing to do here.
// we just throw away the error and start anew.
})
.then(() => this.ensureSessionsForUsersInner(userList));
this.currentClaimPromise = prom;
return prom;
}