gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: test request to


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: test request to diagnose sleep/wakeup issue on iOS
Date: Sat, 13 Jan 2024 14:24:46 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 3277caa38 wallet-core: test request to diagnose sleep/wakeup issue on 
iOS
3277caa38 is described below

commit 3277caa38a693e7faae588133d2604cd7072295a
Author: Florian Dold <florian@dold.me>
AuthorDate: Sat Jan 13 14:24:28 2024 +0100

    wallet-core: test request to diagnose sleep/wakeup issue on iOS
---
 packages/taler-wallet-core/src/db.ts               |  5 ++++-
 packages/taler-wallet-core/src/wallet-api-types.ts | 10 ++++++----
 packages/taler-wallet-core/src/wallet.ts           | 21 ++++++++++++++++++++-
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 549bc7517..263de9d4c 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1324,6 +1324,8 @@ export enum ConfigRecordKey {
   WalletBackupState = "walletBackupState",
   CurrencyDefaultsApplied = "currencyDefaultsApplied",
   DevMode = "devMode",
+  // Only for testing, do not use!
+  TestLoopTx = "testTxLoop",
 }
 
 /**
@@ -1336,7 +1338,8 @@ export type ConfigRecord =
       value: WalletBackupConfState;
     }
   | { key: ConfigRecordKey.CurrencyDefaultsApplied; value: boolean }
-  | { key: ConfigRecordKey.DevMode; value: boolean };
+  | { key: ConfigRecordKey.DevMode; value: boolean }
+  | { key: ConfigRecordKey.TestLoopTx; value: number };
 
 export interface WalletBackupConfState {
   deviceId: string;
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts 
b/packages/taler-wallet-core/src/wallet-api-types.ts
index a4be0f448..7ac347b6d 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -234,6 +234,7 @@ export enum WalletApiOperation {
   TestingWaitTasksProcessed = "testingWaitTasksProcessed",
   ListExchangesForScopedCurrency = "listExchangesForScopedCurrency",
   PrepareWithdrawExchange = "prepareWithdrawExchange",
+  TestingInfiniteTransactionLoop = "testingInfiniteTransactionLoop",
 }
 
 // group: Initialization
@@ -1194,6 +1195,7 @@ export type WalletOperations = {
   [WalletApiOperation.RecoverStoredBackup]: RecoverStoredBackupsOp;
   [WalletApiOperation.UpdateExchangeEntry]: UpdateExchangeEntryOp;
   [WalletApiOperation.PrepareWithdrawExchange]: PrepareWithdrawExchangeOp;
+  [WalletApiOperation.TestingInfiniteTransactionLoop]: any;
 };
 
 export type WalletCoreRequestType<
@@ -1219,8 +1221,8 @@ type RecursivePartial<T extends object> = {
   [P in keyof T]?: T[P] extends Array<infer U extends object>
     ? Array<RecursivePartial<U>>
     : T[P] extends Array<infer J extends Primitives>
-    ? Array<J>
-    : T[P] extends object
-    ? RecursivePartial<T[P]>
-    : T[P];
+      ? Array<J>
+      : T[P] extends object
+        ? RecursivePartial<T[P]>
+        : T[P];
 } & object;
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);
   }

-- 
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]