mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
adding retry
This commit is contained in:
@@ -27,7 +27,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateAllJobSections() {
|
async function updateAllJobSections(retryCount = 0) {
|
||||||
if (isPolling || document.hidden) {
|
if (isPolling || document.hidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,18 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching job updates:', {
|
if (retryCount < 3) {
|
||||||
|
console.debug(`Job polling retry ${retryCount}`, error.message);
|
||||||
|
isPolling = false;
|
||||||
|
|
||||||
|
const retryDelay = Math.pow(2, retryCount) * 1000;
|
||||||
|
setTimeout(() => {
|
||||||
|
updateAllJobSections(retryCount + 1);
|
||||||
|
}, retryDelay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('Job polling failed after 3 retries:', {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
url: url,
|
url: url,
|
||||||
jobId: jobId,
|
jobId: jobId,
|
||||||
|
|||||||
Reference in New Issue
Block a user