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
re-add and actually use promise timeout util
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import { getThreepidsWithBindStatus } from '../../../boundThreepids';
|
||||
import IdentityAuthClient from "../../../IdentityAuthClient";
|
||||
import {abbreviateUrl, unabbreviateUrl} from "../../../utils/UrlUtils";
|
||||
import { getDefaultIdentityServerUrl, doesIdentityServerHaveTerms } from '../../../utils/IdentityServerUtils';
|
||||
import {timeout} from "../../../utils/promise";
|
||||
|
||||
// We'll wait up to this long when checking for 3PID bindings on the IS.
|
||||
const REACHABILITY_TIMEOUT = 10000; // ms
|
||||
@@ -245,14 +246,11 @@ export default class SetIdServer extends React.Component {
|
||||
let threepids = [];
|
||||
let currentServerReachable = true;
|
||||
try {
|
||||
threepids = await Promise.race([
|
||||
threepids = await timeout(
|
||||
getThreepidsWithBindStatus(MatrixClientPeg.get()),
|
||||
new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error("Timeout attempting to reach identity server"));
|
||||
}, REACHABILITY_TIMEOUT);
|
||||
}),
|
||||
]);
|
||||
Promise.reject(new Error("Timeout attempting to reach identity server")),
|
||||
REACHABILITY_TIMEOUT,
|
||||
);
|
||||
} catch (e) {
|
||||
currentServerReachable = false;
|
||||
console.warn(
|
||||
|
||||
Reference in New Issue
Block a user