[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 03/03: use index to check existing tip record
From: |
gnunet |
Subject: |
[taler-wallet-core] 03/03: use index to check existing tip record |
Date: |
Mon, 16 Nov 2020 14:48:49 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit 7e07ad6b2abda4731c0d90038df179296f93d3b7
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Nov 16 14:48:33 2020 +0100
use index to check existing tip record
---
packages/taler-wallet-core/src/operations/tip.ts | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/packages/taler-wallet-core/src/operations/tip.ts
b/packages/taler-wallet-core/src/operations/tip.ts
index 3b8ac026..1d7386b8 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -46,7 +46,7 @@ import { Logger } from "../util/logging";
import { checkDbInvariant } from "../util/invariants";
import { TalerErrorCode } from "../TalerErrorCode";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
-import { j2s } from '../util/helpers';
+import { j2s } from "../util/helpers";
const logger = new Logger("operations/tip.ts");
@@ -73,12 +73,10 @@ export async function prepareTip(
const amount = Amounts.parseOrThrow(tipPickupStatus.tip_amount);
- const merchantOrigin = new URL(res.merchantBaseUrl).origin;
-
- let tipRecord = await ws.db.get(Stores.tips, [
- res.merchantTipId,
- merchantOrigin,
- ]);
+ let tipRecord = await ws.db.getIndexed(
+ Stores.tips.byMerchantTipIdAndBaseUrl,
+ [res.merchantTipId, res.merchantBaseUrl],
+ );
if (!tipRecord) {
logger.trace("new tip, creating tip record");
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.