amend csrf token retries (#16714)

This commit is contained in:
Suzanne Aitchison 2022-02-28 15:05:13 +00:00 committed by GitHub
parent acd5b175ed
commit a70bb4811c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,8 @@
/* global Honeybadger */
const MAX_RETRIES = 30;
const RETRY_INTERVAL = 250;
function getCsrfToken() {
var promise = new Promise(function callback(resolve, reject) {
var i = 0;
@ -14,7 +17,7 @@ function getCsrfToken() {
return resolve(authToken);
}
if (i === 1000) {
if (i === MAX_RETRIES) {
clearInterval(waitingOnCSRF);
Honeybadger.notify(
'Could not locate CSRF metatag ' +
@ -22,7 +25,7 @@ function getCsrfToken() {
);
return reject(new Error('Could not locate CSRF meta tag on the page.'));
}
}, 5);
}, RETRY_INTERVAL);
});
return promise;
}