From a644efe1abe8072bc92efa6d0fefde7504563086 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 11 Apr 2022 15:10:16 -0300 Subject: add a timer parameter in the wallet constructor in order to resolve #7120 --- packages/taler-wallet-core/src/wallet.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 673a86167..e17bbb805 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -192,7 +192,7 @@ import { openPromise, } from "./util/promiseUtils.js"; import { DbAccess, GetReadWriteAccess } from "./util/query.js"; -import { TimerGroup } from "./util/timer.js"; +import { TimerAPI, TimerGroup } from "./util/timer.js"; import { WalletCoreApiClient } from "./wallet-api-types.js"; import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js"; @@ -1080,9 +1080,10 @@ export class Wallet { private constructor( db: DbAccess, http: HttpRequestLibrary, + timer: TimerAPI, cryptoWorkerFactory: CryptoWorkerFactory, ) { - this.ws = new InternalWalletStateImpl(db, http, cryptoWorkerFactory); + this.ws = new InternalWalletStateImpl(db, http, timer, cryptoWorkerFactory); } get client(): WalletCoreApiClient { @@ -1100,9 +1101,10 @@ export class Wallet { static async create( db: DbAccess, http: HttpRequestLibrary, + timer: TimerAPI, cryptoWorkerFactory: CryptoWorkerFactory, ): Promise { - const w = new Wallet(db, http, cryptoWorkerFactory); + const w = new Wallet(db, http, timer, cryptoWorkerFactory); w._client = await getClientFromWalletState(w.ws); return w; } @@ -1153,7 +1155,7 @@ class InternalWalletStateImpl implements InternalWalletState { insecureTrustExchange = false; - timerGroup: TimerGroup = new TimerGroup(); + readonly timerGroup: TimerGroup; latch = new AsyncCondition(); stopped = false; @@ -1200,10 +1202,12 @@ class InternalWalletStateImpl implements InternalWalletState { // and throw an error in that case. public db: DbAccess, public http: HttpRequestLibrary, + public timer: TimerAPI, cryptoWorkerFactory: CryptoWorkerFactory, ) { this.cryptoDispatcher = new CryptoDispatcher(cryptoWorkerFactory); this.cryptoApi = this.cryptoDispatcher.cryptoApi; + this.timerGroup = new TimerGroup(timer) } async getDenomInfo( -- cgit v1.2.3