taler-wallet-cli: stop wallet properly

This commit is contained in:
Florian Dold 2023-02-10 19:47:59 +01:00
parent 8d008641a0
commit 1640859594
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 12 additions and 3 deletions

View File

@ -21,9 +21,11 @@ import { GlobalTestState } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
import { WalletApiOperation, BankApi } from "@gnu-taler/taler-wallet-core";
import {
AbsoluteTime,
AbsoluteTime, j2s, Logger,
} from "@gnu-taler/taler-util";
const logger = new Logger("test-withdrawal-manual.ts");
/**
* Run test for basic, bank-integrated withdrawal.
*/
@ -43,7 +45,9 @@ export async function runWithdrawalManualTest(t: GlobalTestState) {
const tStart = AbsoluteTime.now();
logger.info("starting AcceptManualWithdrawal request");
// We expect this to return immediately.
const wres = await wallet.client.call(
WalletApiOperation.AcceptManualWithdrawal,
{
@ -52,6 +56,9 @@ export async function runWithdrawalManualTest(t: GlobalTestState) {
},
);
logger.info("AcceptManualWithdrawal finished");
logger.info(`result: ${j2s(wres)}`);
// Check that the request did not go into long-polling.
const duration = AbsoluteTime.difference(tStart, AbsoluteTime.now());
if (duration.d_ms > 5 * 1000) {

View File

@ -306,7 +306,9 @@ async function withWallet<T>(
return w.handleCoreApiRequest(operation, "my-req", payload);
},
};
return await f(ctx);
const result = await f(ctx);
w.stop();
return result;
}
}

View File

@ -2040,7 +2040,7 @@ export async function createManualWithdrawal(
x.exchangeDetails,
x.exchangeTrust,
])
.runReadWrite(async (tx) => {
.runReadOnly(async (tx) => {
return await getFundingPaytoUris(tx, withdrawalGroup.withdrawalGroupId);
});