wallet-cli: run benchmark in a loop
This commit is contained in:
parent
589c2a3382
commit
cf25f5698e
@ -17,7 +17,12 @@
|
||||
/**
|
||||
* Imports.
|
||||
*/
|
||||
import { buildCodecForObject, codecForString } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
buildCodecForObject,
|
||||
codecForNumber,
|
||||
codecForString,
|
||||
codecOptional,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import {
|
||||
getDefaultNodeWallet,
|
||||
NodeHttpLib,
|
||||
@ -42,6 +47,9 @@ export async function runBench1(configJson: any): Promise<void> {
|
||||
});
|
||||
await wallet.client.call(WalletApiOperation.InitWallet, {});
|
||||
|
||||
const numIter = b1conf.iterations ?? 1;
|
||||
|
||||
for (let i = 0; i < numIter; i++) {
|
||||
await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
|
||||
amount: "TESTKUDOS:10",
|
||||
bank: b1conf.bank,
|
||||
@ -60,6 +68,7 @@ export async function runBench1(configJson: any): Promise<void> {
|
||||
await wallet.runTaskLoop({
|
||||
stopWhenDone: true,
|
||||
});
|
||||
}
|
||||
|
||||
wallet.stop();
|
||||
}
|
||||
@ -77,6 +86,12 @@ interface Bench1Config {
|
||||
* Base URL of the exchange.
|
||||
*/
|
||||
exchange: string;
|
||||
|
||||
/**
|
||||
* How many withdraw/deposit iterations should be made?
|
||||
* Defaults to 1.
|
||||
*/
|
||||
iterations?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,4 +101,5 @@ const codecForBench1Config = () =>
|
||||
buildCodecForObject<Bench1Config>()
|
||||
.property("bank", codecForString())
|
||||
.property("exchange", codecForString())
|
||||
.property("iterations", codecOptional(codecForNumber()))
|
||||
.build("Bench1Config");
|
||||
|
Loading…
Reference in New Issue
Block a user