feat: update retry algorithm for qstash

avoids dlq until it has to
This commit is contained in:
2024-09-22 16:12:19 -04:00
parent 00d0f641a4
commit 15f680c4d0
4 changed files with 9 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ const GetNextEpisodeAiringAtQuery = graphql(`
status
nextAiringEpisode {
episode
timeUntilAiring
airingAt
}
}
}

View File

@@ -37,15 +37,14 @@ export async function maybeScheduleNextAiringEpisode(
return;
}
const { timeUntilAiring, episode: nextEpisode } = nextAiring;
const { airingAt, episode: nextEpisode } = nextAiring;
const client = new Client({ token: env.QSTASH_TOKEN });
const { messageId } = await client.publishJSON({
url: `${domain}/internal/new-episode`,
body: { aniListId, episodeNumber: nextEpisode },
retries: 0,
delay: timeUntilAiring,
contentBasedDeduplication: true,
retries: 6,
notBefore: airingAt,
});
await Promise.allSettled([
setTitleMessage(env, aniListId, messageId),