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

View File

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