From 4478eb3a23524a8bfb3dd8b4885924c99ab0b2f7 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 9 Sep 2022 22:24:18 -0400 Subject: [PATCH] *Remove unneeded return --- src/query/simple.ts | 1 - src/query/streaming.ts | 13 +++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/query/simple.ts b/src/query/simple.ts index 3ea7cb1..5f3f7c5 100644 --- a/src/query/simple.ts +++ b/src/query/simple.ts @@ -25,7 +25,6 @@ export default class SimpleRpcQuery extends RpcQueryBase { if (Object.keys(this._errors).length) { const error = Object.values(this._errors).pop(); this.resolve(error, error === "timeout"); - return; } } diff --git a/src/query/streaming.ts b/src/query/streaming.ts index 13a4c87..935657c 100644 --- a/src/query/streaming.ts +++ b/src/query/streaming.ts @@ -46,8 +46,6 @@ export default class StreamingRpcQuery extends SimpleRpcQuery { return; } return new Promise((resolve, reject) => { - let timer: any; - const finish = () => { relay = relay as string; this._responses[relay] = {}; @@ -57,10 +55,9 @@ export default class StreamingRpcQuery extends SimpleRpcQuery { const listener = (res: Buffer) => { relay = relay as string; - if (timer) { - clearTimeout(timer as any); - timer = null; - clearTimeout(this._timeoutTimer); + if (this._timeoutTimer) { + clearTimeout(this._timeoutTimer as any); + this._timeoutTimer = null; } if (this._canceled) { @@ -92,10 +89,6 @@ export default class StreamingRpcQuery extends SimpleRpcQuery { }); socket.write("rpc"); socket.write(pack(this._query)); - timer = setTimeout(() => { - this._errors[relay as string] = "timeout"; - reject(null); - }, (this._options.relayTimeout || this._network.relayTimeout) * 1000) as NodeJS.Timeout; }); } }