Use retry_after_ms instead of hardcoded delay

This commit is contained in:
Andrew Morgan 2019-03-06 15:37:06 +00:00
parent 0f14d89257
commit c5198418b0

View file

@ -26,9 +26,6 @@ import Promise from "bluebird";
import Modal from "../../../../../Modal";
import sdk from "../../../../..";
// Delay between failing invite acceptance/rejections to avoid rate-limiting
const INVITE_MANAGEMENT_DELAY = 10000;
export class IgnoredUser extends React.Component {
static propTypes = {
userId: PropTypes.string.isRequired,
@ -132,7 +129,7 @@ export default class SecurityUserSettingsTab extends React.Component {
if (e.errcode === "M_LIMIT_EXCEEDED") {
// Add a delay between each invite change in order to avoid rate
// limiting by the server.
await Promise.delay(INVITE_MANAGEMENT_DELAY);
await Promise.delay(e.retry_after_ms);
// Redo last action
i--;