summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-08 20:39:52 +0100
committerFlorian Dold <florian@dold.me>2022-03-08 20:39:56 +0100
commitd5a933e4cb685aab3e5e6bae5ca2358291e59130 (patch)
tree852e85a8d056fc80bd370c5ac89c5fd7354d0251 /packages/taler-wallet-core/src/db.ts
parent1d1c847b793620acf3a2b193ab45eabf53234cb2 (diff)
downloadwallet-core-d5a933e4cb685aab3e5e6bae5ca2358291e59130.tar.gz
wallet-core-d5a933e4cb685aab3e5e6bae5ca2358291e59130.tar.bz2
wallet-core-d5a933e4cb685aab3e5e6bae5ca2358291e59130.zip
wallet-core: handle reserve retries better
We now always increment the next retry timeout before doing anything else, so that it is impossible to accidentally retry immediately. This fixes a bug where we previously made many, very frequent requests to the bank integration API.
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts23
1 files changed, 13 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 23239069e..52fc94b8d 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -75,31 +75,31 @@ export enum ReserveRecordStatus {
/**
* Reserve must be registered with the bank.
*/
- REGISTERING_BANK = "registering-bank",
+ RegisteringBank = "registering-bank",
/**
* We've registered reserve's information with the bank
* and are now waiting for the user to confirm the withdraw
* with the bank (typically 2nd factor auth).
*/
- WAIT_CONFIRM_BANK = "wait-confirm-bank",
+ WaitConfirmBank = "wait-confirm-bank",
/**
* Querying reserve status with the exchange.
*/
- QUERYING_STATUS = "querying-status",
+ QueryingStatus = "querying-status",
/**
* The corresponding withdraw record has been created.
* No further processing is done, unless explicitly requested
* by the user.
*/
- DORMANT = "dormant",
+ Dormant = "dormant",
/**
* The bank aborted the withdrawal.
*/
- BANK_ABORTED = "bank-aborted",
+ BankAborted = "bank-aborted",
}
/**
@@ -212,7 +212,8 @@ export interface ReserveRecord {
/**
* Is there any work to be done for this reserve?
*
- * FIXME: Technically redundant, since the reserveStatus would indicate this.
+ * Technically redundant, since the reserveStatus would indicate this.
+ * However, we use the operationStatus for DB indexing of pending operations.
*/
operationStatus: OperationStatus;
@@ -222,11 +223,11 @@ export interface ReserveRecord {
lastSuccessfulStatusQuery: Timestamp | undefined;
/**
- * Retry info. This field is present even if no retry is scheduled,
- * because we need it to be present for the index on the object store
- * to work.
+ * Retry info, in case the reserve needs to be processed again
+ * later, either due to an error or because the wallet needs to
+ * wait for something.
*/
- retryInfo: RetryInfo;
+ retryInfo: RetryInfo | undefined;
/**
* Last error that happened in a reserve operation
@@ -830,6 +831,8 @@ export interface ProposalRecord {
/**
* Retry info, even present when the operation isn't active to allow indexing
* on the next retry timestamp.
+ *
+ * FIXME: Clarify what we even retry.
*/
retryInfo?: RetryInfo;