失败自动重试,如何设置退避系数
Automatic retry on failure, How to set Backoff coefficient
const df = require("durable-functions");
module.exports = df.orchestrator(function*(context) {
const retryOptions = new df.RetryOptions(5000, 3);
yield context.df.callActivityWithRetry("FlakyFunction", retryOptions);
// ...
});
There are several options for customizing the automatic retry policy. They include the following:
最大尝试次数:最大重试次数。
第一次重试间隔:第一次重试之前等待的时间。
退避系数:用于确定退避增加率的系数。默认为 1。
如何设置退避系数?
RetryOptions
的构造函数只有两个参数,构造后设置backoffCoefficient
即可,其他参数相同
const retryOptions = new df.RetryOptions(5000, 3);
retryOptions.backoffCoefficient = 2;
const df = require("durable-functions");
module.exports = df.orchestrator(function*(context) {
const retryOptions = new df.RetryOptions(5000, 3);
yield context.df.callActivityWithRetry("FlakyFunction", retryOptions);
// ...
});
There are several options for customizing the automatic retry policy. They include the following:
最大尝试次数:最大重试次数。
第一次重试间隔:第一次重试之前等待的时间。
退避系数:用于确定退避增加率的系数。默认为 1。
如何设置退避系数?
RetryOptions
的构造函数只有两个参数,构造后设置backoffCoefficient
即可,其他参数相同
const retryOptions = new df.RetryOptions(5000, 3);
retryOptions.backoffCoefficient = 2;