diff options
author | Sebastian <sebasjm@gmail.com> | 2022-04-11 15:10:16 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-04-11 15:10:16 -0300 |
commit | a644efe1abe8072bc92efa6d0fefde7504563086 (patch) | |
tree | 8a6dd486d991e547d12290d2f96eb2f23d7e7d56 /packages/taler-wallet-core/src/wallet.ts | |
parent | ccb50c636054819f5af8778cc3ebe5258b1c2e87 (diff) | |
download | wallet-core-a644efe1abe8072bc92efa6d0fefde7504563086.tar.xz |
add a timer parameter in the wallet constructor in order to resolve #7120
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 12 |
1 files changed, 8 insertions, 4 deletions
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<typeof WalletStoresV1>, 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<typeof WalletStoresV1>, http: HttpRequestLibrary, + timer: TimerAPI, cryptoWorkerFactory: CryptoWorkerFactory, ): Promise<Wallet> { - 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<typeof WalletStoresV1>, 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( |