Files
klz-cables.com/.pnpm-store/v10/files/50/7befad51aa84f71ea5550b238e474d9b4134b34caa4432a161b959cfde75d5a9674aedc073179be58d3b1f145769d6c2867ad789626224856f8d8aa13ce0fe
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

27 lines
1.3 KiB
Plaintext

import { getCurrentDate } from '../utilities/getCurrentDate.js';
export function calculateBackoffWaitUntil({ retriesConfig, totalTried }) {
let waitUntil = getCurrentDate();
if (typeof retriesConfig === 'object') {
if (retriesConfig.backoff) {
if (retriesConfig.backoff.type === 'fixed') {
waitUntil = retriesConfig.backoff.delay ? new Date(getCurrentDate().getTime() + retriesConfig.backoff.delay) : getCurrentDate();
} else if (retriesConfig.backoff.type === 'exponential') {
// 2 ^ (attempts - 1) * delay (current attempt is not included in totalTried, thus no need for -1)
const delay = retriesConfig.backoff.delay ? retriesConfig.backoff.delay : 0;
waitUntil = new Date(getCurrentDate().getTime() + Math.pow(2, totalTried) * delay);
}
}
}
/*
const differenceInMSBetweenNowAndWaitUntil = waitUntil.getTime() - getCurrentDate().getTime()
const differenceInSBetweenNowAndWaitUntil = differenceInMSBetweenNowAndWaitUntil / 1000
console.log('Calculated backoff', {
differenceInMSBetweenNowAndWaitUntil,
differenceInSBetweenNowAndWaitUntil,
retriesConfig,
totalTried,
})*/ return waitUntil;
}
//# sourceMappingURL=calculateBackoffWaitUntil.js.map