From 40b991900a690409126b68f14e022c234ebfd669 Mon Sep 17 00:00:00 2001 From: Patrick Kenyon Date: Thu, 9 Dec 2021 10:03:57 -0700 Subject: [PATCH] Removed redundant function Signed-off-by: Patrick Kenyon --- packages/core/src/modules/ledger/IndyPool.ts | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/core/src/modules/ledger/IndyPool.ts b/packages/core/src/modules/ledger/IndyPool.ts index cda85c97f9..23ebeb4bea 100644 --- a/packages/core/src/modules/ledger/IndyPool.ts +++ b/packages/core/src/modules/ledger/IndyPool.ts @@ -75,7 +75,7 @@ export class IndyPool { } public async connect() { - this.poolConnected = (async () => { + this.poolConnected = (async ()=>{ const poolName = this.poolConfig.id const genesisPath = await this.getGenesisPath() @@ -110,23 +110,11 @@ export class IndyPool { return this.poolConnected } - /** - * If the pool is already trying to connect it will wait for it, - * otherwise it will not wait - */ - private async pendingConnection() { - if (this.poolConnected != undefined) { - await this.poolConnected - } - } - private async submitRequest(request: Indy.LedgerRequest) { - await this.pendingConnection() return this.indy.submitRequest(await this.getPoolHandle(), request) } public async submitReadRequest(request: Indy.LedgerRequest) { - await this.pendingConnection() const response = await this.submitRequest(request) if (isLedgerRejectResponse(response)) { @@ -137,7 +125,7 @@ export class IndyPool { } public async submitWriteRequest(request: Indy.LedgerRequest) { - await this.pendingConnection() + const response = await this.submitRequest(request) if (isLedgerRejectResponse(response)) { @@ -148,6 +136,10 @@ export class IndyPool { } private async getPoolHandle() { + if (this.poolConnected != undefined) { + //If we have tried to already connect to pool wait for it + await this.poolConnected + } if (!this._poolHandle) { return this.connect() }