summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-18 18:23:06 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-18 18:23:06 +0530
commite2f7bc79cd4326f769f370f230041101a099d98c (patch)
treecd14da6ca277d20cfbd48cb15850c32e9e1ffb83 /packages/taler-wallet-core/src/operations/pay.ts
parent53cd347b1c75496e4f6feee7792cc81c2aeda961 (diff)
downloadwallet-core-e2f7bc79cd4326f769f370f230041101a099d98c.tar.gz
wallet-core-e2f7bc79cd4326f769f370f230041101a099d98c.tar.bz2
wallet-core-e2f7bc79cd4326f769f370f230041101a099d98c.zip
introduce locking to avoid certain simultaneous requests to the exchange
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index c3dd6c6d3..996e1c1ec 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -57,7 +57,7 @@ import { Logger } from "../util/logging";
import { parsePayUri } from "../util/taleruri";
import { guardOperationException, OperationFailedError } from "./errors";
import { createRefreshGroup, getTotalRefreshCost } from "./refresh";
-import { InternalWalletState } from "./state";
+import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state";
import { getTimestampNow, timestampAddDuration } from "../util/time";
import { strcmp, canonicalJson } from "../util/helpers";
import { readSuccessResponseJsonOrThrow } from "../util/http";
@@ -796,7 +796,9 @@ export async function submitPay(
logger.trace("making pay request", JSON.stringify(reqBody, undefined, 2));
- const resp = await ws.http.postJson(payUrl, reqBody);
+ const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], () =>
+ ws.http.postJson(payUrl, reqBody),
+ );
const merchantResp = await readSuccessResponseJsonOrThrow(
resp,