gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 02/03: logging


From: gnunet
Subject: [taler-wallet-core] 02/03: logging
Date: Mon, 11 May 2020 14:52:09 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

commit d9433a2116541160ed82f6780116c1c70afe4e2f
Author: Florian Dold <address@hidden>
AuthorDate: Mon May 11 18:19:43 2020 +0530

    logging
---
 src/headless/integrationtest.ts |  7 +------
 src/operations/refresh.ts       |  4 ----
 src/operations/withdraw.ts      |  6 ------
 src/util/query.ts               |  3 ---
 src/wallet.ts                   | 31 +++++++++----------------------
 5 files changed, 10 insertions(+), 41 deletions(-)

diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts
index 24ceb9ce..5beb7b79 100644
--- a/src/headless/integrationtest.ts
+++ b/src/headless/integrationtest.ts
@@ -77,9 +77,8 @@ async function makePayment(
 
   paymentStatus = await merchant.checkPayment(orderResp.orderId);
 
-  console.log("payment status after wallet payment:", paymentStatus);
-
   if (!paymentStatus.paid) {
+    console.log("payment status:", paymentStatus);
     throw Error("payment did not succeed");
   }
 
@@ -112,10 +111,6 @@ export async function runIntegrationTest(args: 
IntegrationTestArgs): Promise<voi
   );
   logger.info("done withdrawing test balance");
 
-  const balance = await myWallet.getBalances();
-
-  console.log(JSON.stringify(balance, null, 2));
-
   const myMerchant = new MerchantBackendConnection(
     args.merchantBaseUrl,
     args.merchantApiKey,
diff --git a/src/operations/refresh.ts b/src/operations/refresh.ts
index 56d18f28..5563d94d 100644
--- a/src/operations/refresh.ts
+++ b/src/operations/refresh.ts
@@ -355,7 +355,6 @@ async function refreshReveal(
     `refreshes/${refreshSession.hash}/reveal`,
     refreshSession.exchangeBaseUrl,
   );
-  logger.trace("reveal request:", req);
 
   let resp;
   try {
@@ -366,9 +365,6 @@ async function refreshReveal(
     return;
   }
 
-  logger.trace("session:", refreshSession);
-  logger.trace("reveal response:", resp);
-
   if (resp.status !== 200) {
     console.error("error: /refresh/reveal returned status " + resp.status);
     return;
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index 8e40a953..7c079dc4 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -361,16 +361,10 @@ export async function getVerifiedWithdrawDenomList(
     for (const denomSel of selectedDenoms.selectedDenoms) {
       const denom = denomSel.denom;
       if (denom.status === DenominationStatus.Unverified) {
-        console.log(
-          "checking validity",
-          denom,
-          exchangeDetails.masterPublicKey,
-        );
         const valid = await ws.cryptoApi.isValidDenom(
           denom,
           exchangeDetails.masterPublicKey,
         );
-        console.log("done checking validity");
         if (!valid) {
           denom.status = DenominationStatus.VerifiedBad;
           allValid = false;
diff --git a/src/util/query.ts b/src/util/query.ts
index 401d22e7..be319049 100644
--- a/src/util/query.ts
+++ b/src/util/query.ts
@@ -436,9 +436,6 @@ export function openDatabase(
         throw Error("upgrade needed, but new version unknown");
       }
       onUpgradeNeeded(db, e.oldVersion, newVersion);
-      console.log(
-        `DB: upgrade needed: oldVersion=${e.oldVersion}, 
newVersion=${e.newVersion}`,
-      );
     };
   });
 }
diff --git a/src/wallet.ts b/src/wallet.ts
index 41569a44..3558e102 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -252,14 +252,19 @@ export class Wallet {
    * returns without resolving to an exception.
    */
   public async runUntilDone(): Promise<void> {
+    let done = false;
     const p = new Promise((resolve, reject) => {
       // Run this asynchronously
       this.addNotificationListener((n) => {
+        if (done) {
+          return;
+        }
         if (
           n.type === NotificationType.WaitingForRetry &&
           n.numGivingLiveness == 0
         ) {
-          logger.trace("no liveness-giving operations left, returning");
+          done = true;
+          logger.trace("no liveness-giving operations left");
           resolve();
         }
       });
@@ -277,23 +282,9 @@ export class Wallet {
    * returns without resolving to an exception.
    */
   public async runUntilDoneAndStop(): Promise<void> {
-    const p = new Promise((resolve, reject) => {
-      // Run this asynchronously
-      this.addNotificationListener((n) => {
-        if (
-          n.type === NotificationType.WaitingForRetry &&
-          n.numGivingLiveness == 0
-        ) {
-          logger.trace("no liveness-giving operations left, stopping");
-          this.stop();
-        }
-      });
-      this.runRetryLoop().catch((e) => {
-        console.log("exception in wallet retry loop");
-        reject(e);
-      });
-    });
-    await p;
+    await this.runUntilDone();
+    logger.trace("stopping after liveness-giving operations done");
+    this.stop();
   }
 
   /**
@@ -314,9 +305,7 @@ export class Wallet {
 
   private async runRetryLoopImpl(): Promise<void> {
     while (!this.stopped) {
-      console.log("running wallet retry loop iteration");
       const pending = await this.getPendingOperations({ onlyDue: true });
-      console.log("pending ops", JSON.stringify(pending, undefined, 2));
       if (pending.pendingOperations.length === 0) {
         const allPending = await this.getPendingOperations({ onlyDue: false });
         let numPending = 0;
@@ -346,12 +335,10 @@ export class Wallet {
         await Promise.race([timeout, this.latch.wait()]);
         console.log("timeout done");
       } else {
-        logger.trace("running pending operations that are due");
         // FIXME: maybe be a bit smarter about executing these
         // operations in parallel?
         for (const p of pending.pendingOperations) {
           try {
-            console.log("running", p);
             await this.processOnePendingOperation(p);
           } catch (e) {
             console.error(e);

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]