Ability to change retry() params from the task?
See original GitHub issueHello,
I would like to know if it’d be possible to be able to update the times
argument of the retry()
from the task
?
For instance, I would like to be able to increase the interval
value as the attempt count increases or trim down the attempt count to 0
when a particular error occurred (in order to avoid unnecessary doomed attempts).
Example:
var opts = {
times: 3,
interval: 500
};
async.retry(opts, function (callback) {
someCall(function(err) {
if (err) {
switch (err.code) {
case 'Code1':
opts.interval += 500; // Increases the interval for next attempt
return callback(err);
case 'Code2':
opts.times = 0; // Avoid other attempts
return callback(err);
default:
return callback(err);
}
}
callback();
});
}, function (err) {
// Some code
});
Any idea or workaround?
Thanks,
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
HTTP retry change url's parameter - javascript - Stack Overflow
this.myRequest() .pipe(this.http_retry()) .subscribe(resData => { ...
Read more >Retry pipeline - provide variables, their values (hidden) and ...
You can retry a pipeline, quickly changing on the variables necessary, without having to re-run the entire pipeline from scratch and entering in ......
Read more >Error handling in Step Functions - AWS Documentation
An attempt to replace a field, within a state's Parameters field, ... Task and Parallel states can have a field named Retry ,...
Read more >Retry pattern - Azure Architecture Center | Microsoft Learn
Implement retry logic only where the full context of a failing operation is understood. For example, if a task that contains a retry...
Read more >Retrying event-driven functions - Google Cloud
If you want to retry the function when an error occurs, you can change the default retry policy by setting the "retry on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the behavior added in #1161 should be good enough for now.
Hmmn, perhaps we could make the retry
opts
more polymorphic – if you pass an array for the interval, it uses those numbers for each delay interval in sequence.