Add delay to LDB retry after ENOTFOUND error.

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2024-04-29 11:20:27 +01:00
parent 8fa0cf775f
commit fde37814a7
1 changed files with 5 additions and 0 deletions

View File

@ -141,6 +141,7 @@ async function staffApiCallRetry(api, method, options, retries) {
logger.warn(err, "DNS ERR")
if (i < retries - 1) {
logger.debug('Retrying API Call')
await delay(500)
continue;
}
}
@ -150,6 +151,10 @@ async function staffApiCallRetry(api, method, options, retries) {
throw new Error("Max retries exceeded");
}
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function getReasonCodeList() {
logger.debug("ldbService.getReasonCodeList: Fetching reason code list");
try {