Granular retry logic
retry: { maxAttempts: 168, // Total attempts for 7 days factor: 1, // No exponential backoff randomize: true, // Still randomize within the given interval minTimeoutInMs: attempt => { if (attempt <= 24) { // For the first 24 attempts (first day), retry every hour return 3_600_000; // 1 hour in milliseconds } else { // After the first day, retry once every 24 hours return 24 3_600_000; // 24 hours in milliseconds } }, maxTimeoutInMs: attempt => { if (attempt <= 24) { // For the first 24 attempts (first day), retry every hour return 3_600_000; // 1 hour in milliseconds } else { // After the first day, retry once every 24 hours return 24 3_600_000; // 24 hours in milliseconds } } }This would allow truly custom retry logic.
Where you perhaps the first 24 hours want to retry more frequently and then just once a day for a certain interval.
Comments2
Anonymous User
Sep 19, 2024
It’s not quite what you’re suggesting but handleError does allow you to do programmable retry logic. You can set when the next retry will be and prevent retries from happening.
https://trigger.dev/docs/errors-retrying#openai-error-handling-example
Olle Bergkvist
Sep 18, 2024