*Remove unneeded return
This commit is contained in:
parent
3d52e6fd7b
commit
4478eb3a23
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue