You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this look like a reasonably safe use of retry?. I am trying to implement a 2-3 attempt retry when something goes awry in my redis subscriber. If it fails after max attempts I will just save to a dead letter queue table in my database (or raise some sort of alert if the the db save fails :))
pubsub.subscribe(`TEST`, async(message) => {
console.log("processing...", message )
var operation = retry.operation({
retries: 2,
factor: 2,
minTimeout: 1 * 1000,
maxTimeout: 60 * 1000,
randomize: false,
});
return operation.attempt(async(currentAttempt) => {
console.log("currentAttempt is",currentAttempt)
let err
try{
//my logic that might fail and throw an error goes here
}catch(whoops){
err = whoops
}
if (operation.retry(err)) {
console.log('returning for a retry...')
return;
}
if(operation.mainError()){
console.log("There was a persistent error, we should save message to a DLQ here:" ,operation.mainError().message)
}
})
})
The text was updated successfully, but these errors were encountered:
Does this look like a reasonably safe use of retry?. I am trying to implement a 2-3 attempt retry when something goes awry in my redis subscriber. If it fails after max attempts I will just save to a dead letter queue table in my database (or raise some sort of alert if the the db save fails :))
The text was updated successfully, but these errors were encountered: