update bench1 config

This commit is contained in:
Boss Marco 2021-10-26 10:50:01 +02:00
parent 835ac85a28
commit fb23bab6fe
No known key found for this signature in database
GPG Key ID: 89A3EC33C625C3DF

View File

@ -48,10 +48,13 @@ export async function runBench1(configJson: any): Promise<void> {
await wallet.client.call(WalletApiOperation.InitWallet, {}); await wallet.client.call(WalletApiOperation.InitWallet, {});
const numIter = b1conf.iterations ?? 1; const numIter = b1conf.iterations ?? 1;
const numDeposits = b1conf.deposits ?? 5;
const withdrawAmount = (numDeposits + 1) * 10;
for (let i = 0; i < numIter; i++) { for (let i = 0; i < numIter; i++) {
await wallet.client.call(WalletApiOperation.WithdrawFakebank, { await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
amount: "TESTKUDOS:10", amount: b1conf.currency + ":" + string(withdrawAmount),
bank: b1conf.bank, bank: b1conf.bank,
exchange: b1conf.exchange, exchange: b1conf.exchange,
}); });
@ -60,14 +63,16 @@ export async function runBench1(configJson: any): Promise<void> {
stopWhenDone: true, stopWhenDone: true,
}); });
await wallet.client.call(WalletApiOperation.CreateDepositGroup, { for (let i = 0; i < numDeposits; i++) {
amount: "TESTKUDOS:5", await wallet.client.call(WalletApiOperation.CreateDepositGroup, {
depositPaytoUri: "payto://x-taler-bank/localhost/foo", amount: b1conf.currency + ":10",
}); depositPaytoUri: b1conf.payto,
});
await wallet.runTaskLoop({ await wallet.runTaskLoop({
stopWhenDone: true, stopWhenDone: true,
}); });
}
} }
wallet.stop(); wallet.stop();
@ -82,6 +87,11 @@ interface Bench1Config {
*/ */
bank: string; bank: string;
/**
* Payto url for deposits.
*/
payto: string;
/** /**
* Base URL of the exchange. * Base URL of the exchange.
*/ */
@ -92,6 +102,10 @@ interface Bench1Config {
* Defaults to 1. * Defaults to 1.
*/ */
iterations?: number; iterations?: number;
currency: string;
deposits?: number;
} }
/** /**
@ -100,6 +114,9 @@ interface Bench1Config {
const codecForBench1Config = () => const codecForBench1Config = () =>
buildCodecForObject<Bench1Config>() buildCodecForObject<Bench1Config>()
.property("bank", codecForString()) .property("bank", codecForString())
.property("payto", codecForString())
.property("exchange", codecForString()) .property("exchange", codecForString())
.property("iterations", codecOptional(codecForNumber())) .property("iterations", codecOptional(codecForNumber()))
.property("deposits", codecOptional(codecForNumber()))
.property("currency", codecForString())
.build("Bench1Config"); .build("Bench1Config");