gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 09/11: purge wallet after a specified amount of iter


From: gnunet
Subject: [taler-wallet-core] 09/11: purge wallet after a specified amount of iterations
Date: Thu, 18 Nov 2021 13:52:45 +0100

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

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

commit ba198eab4a368b3a8dc2992e17e2b88ad377e287
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Fri Nov 12 17:28:11 2021 +0100

    purge wallet after a specified amount of iterations
---
 packages/taler-wallet-cli/src/bench1.ts | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/packages/taler-wallet-cli/src/bench1.ts 
b/packages/taler-wallet-cli/src/bench1.ts
index 0e2f94f9..f0db9761 100644
--- a/packages/taler-wallet-cli/src/bench1.ts
+++ b/packages/taler-wallet-cli/src/bench1.ts
@@ -28,6 +28,7 @@ import {
   getDefaultNodeWallet,
   NodeHttpLib,
   WalletApiOperation,
+  Wallet,
 } from "@gnu-taler/taler-wallet-core";
 
 /**
@@ -48,20 +49,25 @@ export async function runBench1(configJson: any): 
Promise<void> {
 
   const numIter = b1conf.iterations ?? 1;
   const numDeposits = b1conf.deposits ?? 5;
+  const restartWallet = b1conf.restartAfter ?? 20;
 
   const withdrawAmount = (numDeposits + 1) * 10;
 
   logger.info(`Starting Benchmark iterations=${numIter} 
deposits=${numDeposits}`);
 
+  let wallet = {} as Wallet;
+
   for (let i = 0; i < numIter; i++) {
     // Create a new wallet in each iteration 
     // otherwise the TPS go down 
     // my assumption is that the in-memory db file gets too large 
-    const wallet = await getDefaultNodeWallet({
-      // No persistent DB storage.
-      persistentStoragePath: undefined,
-      httpLib: myHttpLib,
-    });
+    if (i % restartWallet == 0) {
+      wallet = await getDefaultNodeWallet({
+        // No persistent DB storage.
+        persistentStoragePath: undefined,
+        httpLib: myHttpLib,
+      });
+    }
     await wallet.client.call(WalletApiOperation.InitWallet, {});
        
     logger.trace(`Starting withdrawal amount=${withdrawAmount}`);
@@ -128,6 +134,12 @@ interface Bench1Config {
   currency: string;
 
   deposits?: number;
+
+  /**
+   * How any iterations run until the wallet db gets purged
+   * Defaults to 20.
+   */
+  restartAfter?: number;
 }
 
 /**
@@ -141,4 +153,5 @@ const codecForBench1Config = () =>
     .property("iterations", codecOptional(codecForNumber()))
     .property("deposits", codecOptional(codecForNumber()))
     .property("currency", codecForString())
+    .property("restartAfter", codecOptional(codecForNumber()))
     .build("Bench1Config");

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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