Delivery backoff tweaks
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
This commit is contained in:
parent
5ff8540b22
commit
e845eda898
|
@ -33,6 +33,11 @@ function apBackoff(attemptsMade: number, err: Error) {
|
||||||
const baseDelay = 60 * 1000; // 1min
|
const baseDelay = 60 * 1000; // 1min
|
||||||
const maxBackoff = 8 * 60 * 60 * 1000; // 8hours
|
const maxBackoff = 8 * 60 * 60 * 1000; // 8hours
|
||||||
let backoff = (Math.pow(2, attemptsMade) - 1) * baseDelay;
|
let backoff = (Math.pow(2, attemptsMade) - 1) * baseDelay;
|
||||||
|
|
||||||
|
if (err?.message?.startsWith("RetriableLater")) {
|
||||||
|
backoff += (Math.pow(1.5, attemptsMade) - 1) * baseDelay * 10 * attemptsMade;
|
||||||
|
}
|
||||||
|
|
||||||
backoff = Math.min(backoff, maxBackoff);
|
backoff = Math.min(backoff, maxBackoff);
|
||||||
backoff += Math.round(backoff * Math.random() * 0.2);
|
backoff += Math.round(backoff * Math.random() * 0.2);
|
||||||
return backoff;
|
return backoff;
|
||||||
|
|
|
@ -76,8 +76,8 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||||
|
|
||||||
// 5xx etc.
|
// 5xx etc.
|
||||||
throw new Error(`${err.retry_class}: ${err.message}`);
|
throw new Error(`${err.retry_class}: ${err.message}`);
|
||||||
} else {
|
|
||||||
throw res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw res;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue