feat: update retry algorithm for qstash
avoids dlq until it has to
This commit is contained in:
@@ -121,8 +121,8 @@ app.openapi(route, async (c) => {
|
||||
client.publishJSON({
|
||||
url: c.req.url,
|
||||
body: { deviceId, watchStatus, titleId, isRetrying: true },
|
||||
retries: 0,
|
||||
delay: 60,
|
||||
retries: 3,
|
||||
delay: "1m",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ const GetNextEpisodeAiringAtQuery = graphql(`
|
||||
status
|
||||
nextAiringEpisode {
|
||||
episode
|
||||
timeUntilAiring
|
||||
airingAt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -92,7 +92,7 @@ async function triggerNextEpisodeRoute(titleId: number) {
|
||||
aniListId: titleId,
|
||||
episodeNumber: mostRecentEpisodeNumber,
|
||||
},
|
||||
retries: 0,
|
||||
retries: 6,
|
||||
})
|
||||
.then(() => true)
|
||||
.catch((error) => {
|
||||
@@ -124,8 +124,8 @@ async function triggerNextEpisodeRoute(titleId: number) {
|
||||
aniListId: titleId,
|
||||
episodeNumber: title.nextAiringEpisode.episode,
|
||||
},
|
||||
retries: 0,
|
||||
delay: title.nextAiringEpisode.timeUntilAiring,
|
||||
retries: 6,
|
||||
notBefore: title.nextAiringEpisode.airingAt,
|
||||
})
|
||||
.then(() => true)
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user