*Handle edge case if we have no responses

This commit is contained in:
Derrick Hammer 2022-09-09 06:04:02 -04:00
parent e6ec3cdc4c
commit 46f693a1f2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,19 @@ export default class WisdomRpcQuery extends RpcQueryBase {
{}
);
if (!Object.keys(responses).length) {
if (Object.keys(this._errors).length) {
this.resolve({ error: Object.values(this._errors).pop() });
return;
}
if (this._tries <= this._maxTries) {
this._tries++;
this.retry();
return;
}
this.resolve({ data: { error: ERR_MAX_TRIES_HIT } });
return;
}
for (const responseHash in responses) {
if (
responses[responseHash] / responseStoreData.length >=