diff options
author | Florian Dold <florian@dold.me> | 2024-01-13 14:24:28 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-13 14:24:28 +0100 |
commit | 3277caa38a693e7faae588133d2604cd7072295a (patch) | |
tree | 80dd3fad250dc4080d974e7963ad729fc9660b86 /packages/taler-wallet-core/src/wallet.ts | |
parent | 2487a06bfea973dc92b7e3aff2e7a70f48d2cf17 (diff) | |
download | wallet-core-3277caa38a693e7faae588133d2604cd7072295a.tar.xz |
wallet-core: test request to diagnose sleep/wakeup issue on iOS
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index da34ff37f..8d5028d47 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -298,7 +298,7 @@ import { GetReadOnlyAccess, GetReadWriteAccess, } from "./util/query.js"; -import { TimerAPI, TimerGroup } from "./util/timer.js"; +import { TimerAPI, TimerGroup, timer } from "./util/timer.js"; import { WALLET_BANK_CONVERSION_API_PROTOCOL_VERSION, WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, @@ -1393,6 +1393,25 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( ws.workAvailable.trigger(); return {}; } + case WalletApiOperation.TestingInfiniteTransactionLoop: { + const myDelayMs = (payload as any).delayMs ?? 5; + let loopCount = 0; + while (true) { + logger.info(`looping test write tx, iteration ${loopCount}`); + await ws.db.runReadWriteTx(["config"], async (tx) => { + await tx.config.put({ + key: ConfigRecordKey.TestLoopTx, + value: loopCount, + }); + }); + if (myDelayMs != 0) { + await new Promise<void>((resolve, reject) => { + setTimeout(() => resolve(), myDelayMs); + }); + } + loopCount = (loopCount + 1) % (Number.MAX_SAFE_INTEGER - 1); + } + } // default: // assertUnreachable(operation); } |