*Remove unneeded return

This commit is contained in:
Derrick Hammer 2022-09-09 22:24:18 -04:00
parent 3d52e6fd7b
commit 4478eb3a23
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 3 additions and 11 deletions

View File

@ -25,7 +25,6 @@ export default class SimpleRpcQuery extends RpcQueryBase {
if (Object.keys(this._errors).length) { if (Object.keys(this._errors).length) {
const error = Object.values(this._errors).pop(); const error = Object.values(this._errors).pop();
this.resolve(error, error === "timeout"); this.resolve(error, error === "timeout");
return;
} }
} }

View File

@ -46,8 +46,6 @@ export default class StreamingRpcQuery extends SimpleRpcQuery {
return; return;
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let timer: any;
const finish = () => { const finish = () => {
relay = relay as string; relay = relay as string;
this._responses[relay] = {}; this._responses[relay] = {};
@ -57,10 +55,9 @@ export default class StreamingRpcQuery extends SimpleRpcQuery {
const listener = (res: Buffer) => { const listener = (res: Buffer) => {
relay = relay as string; relay = relay as string;
if (timer) { if (this._timeoutTimer) {
clearTimeout(timer as any); clearTimeout(this._timeoutTimer as any);
timer = null; this._timeoutTimer = null;
clearTimeout(this._timeoutTimer);
} }
if (this._canceled) { if (this._canceled) {
@ -92,10 +89,6 @@ export default class StreamingRpcQuery extends SimpleRpcQuery {
}); });
socket.write("rpc"); socket.write("rpc");
socket.write(pack(this._query)); 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;
}); });
} }
} }