mirror of
https://github.com/status-im/github-webhook-filter.git
synced 2025-02-10 12:36:33 +00:00
fix: cloudflare uses seconds for retry-after
This commit is contained in:
parent
0917fa7382
commit
28dfe8c61a
@ -29,7 +29,13 @@ export async function sendWebhook(
|
||||
// should always exist, even for cf bans, but checking anyway
|
||||
if (reset === null) break;
|
||||
|
||||
const resetms = parseFloat(reset);
|
||||
// parse retry delay
|
||||
let resetms = parseFloat(reset);
|
||||
if (!res.headers.has("via")) {
|
||||
// if there's no `via` header, this is likely a cf ban, which uses seconds instead of milliseconds
|
||||
resetms *= 1000;
|
||||
}
|
||||
|
||||
// if we'd wait longer than the configured limit, just return the 429
|
||||
if (resetms > config.maxWebhookRetryMs) {
|
||||
log.warning(
|
||||
|
Loading…
x
Reference in New Issue
Block a user