fix(discord) : cancel sync after three failed attempts
This commit is contained in:
+2
-1
@@ -12,7 +12,7 @@ import {
|
||||
} from "@/lib/catalog/sync";
|
||||
import { closeRedisClient, discordWorkerHeartbeatKey, getRedisClient } from "@/lib/redis/client";
|
||||
|
||||
const RETRY_DELAYS_MS = [0, 30_000, 120_000, 600_000, 1_800_000] as const;
|
||||
const RETRY_DELAYS_MS = [0, 30_000, 120_000] as const;
|
||||
|
||||
function required(name: string): string {
|
||||
const value = process.env[name]?.trim();
|
||||
@@ -114,6 +114,7 @@ async function syncWithRetry(messageUrl: string): Promise<void> {
|
||||
if (cancellation.signal.aborted) return;
|
||||
const message = cause instanceof Error ? cause.message : String(cause);
|
||||
if (attempt === RETRY_DELAYS_MS.length - 1) {
|
||||
cancellation.abort();
|
||||
const details = { attempts: attempt + 1, error: message };
|
||||
log("sync_failed", details);
|
||||
await notify("sync failed", details);
|
||||
|
||||
Reference in New Issue
Block a user