有backoffCoefficient设置时,如何计算持久函数的下一次重试时间?

How is the next retry time calculated for durable functions when there is a backoffCoefficient set?

如果我的 activity 函数失败,我希望它能自动重试。我希望它先在几秒钟后重试,然后再重复。最后一次尝试应该在大约 4 天之后。最初的重试应该间隔几秒钟,然后频率应该降低,这样到最后它每 4 小时左右重试一次。应该如何设置 RetryOptions 的参数来完成此操作? IE。给定以下参数,计算重试次数顺序的公式是什么:

firstRetryIntervalInMilliseconds = 3000
maxNumberOfAttempts  = 100
backoffCoefficient  = 2

CallActivityWithRetry 使用 exponential backoff mechanism to calculate retry intervals. (source code) 第 n 次重试的延迟由以下公式计算:

firstRetryIntervalInMilliseconds * backoffCoefficient ^ n

RetryOptions class 有许多可配置的属性,包括 MaxRetryIntervalRetryTimeout,应该有助于实现您想要的重试行为。