diff options
Diffstat (limited to 'packages/taler-wallet-core/src/util/retries.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/retries.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/retries.ts b/packages/taler-wallet-core/src/util/retries.ts index 4b78d38ef..25b4c5055 100644 --- a/packages/taler-wallet-core/src/util/retries.ts +++ b/packages/taler-wallet-core/src/util/retries.ts @@ -92,3 +92,18 @@ export function initRetryInfo(p: RetryPolicy = defaultRetryPolicy): RetryInfo { updateRetryInfoTimeout(info, p); return info; } + +export namespace RetryInfo { + export function increment( + r: RetryInfo | undefined, + p: RetryPolicy = defaultRetryPolicy, + ) { + if (!r) { + return initRetryInfo(p); + } + const r2 = { ...r }; + r2.retryCounter++; + updateRetryInfoTimeout(r2, p); + return r2; + } +} |