diff options
Diffstat (limited to 'packages/taler-wallet-core/src/types')
-rw-r--r-- | packages/taler-wallet-core/src/types/dbTypes.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts index 82260963b..e36e322d1 100644 --- a/packages/taler-wallet-core/src/types/dbTypes.ts +++ b/packages/taler-wallet-core/src/types/dbTypes.ts @@ -117,6 +117,17 @@ export function updateRetryInfoTimeout( r.nextRetry = { t_ms: t }; } +export function getRetryDuration( + r: RetryInfo, + p: RetryPolicy = defaultRetryPolicy, +): Duration { + if (p.backoffDelta.d_ms === "forever") { + return { d_ms: "forever" }; + } + const t = p.backoffDelta.d_ms * Math.pow(p.backoffBase, r.retryCounter); + return { d_ms: t }; +} + export function initRetryInfo( active = true, p: RetryPolicy = defaultRetryPolicy, |