diff options
author | Florian Dold <florian@dold.me> | 2022-03-28 23:21:49 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-28 23:21:49 +0200 |
commit | 80e43db2cac84e588c2ef3889e8d90b76bd53714 (patch) | |
tree | 04297a4ad1838f9c1add039d64ee1b1996cfd6b2 /packages/taler-wallet-core/src/util | |
parent | c194bd539a9e01d083b953ef1e0022da90574339 (diff) | |
download | wallet-core-80e43db2cac84e588c2ef3889e8d90b76bd53714.tar.xz |
wallet: timeout handling refactoring WIP
Diffstat (limited to 'packages/taler-wallet-core/src/util')
-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; + } +} |