From 46f693a1f2b8cce16069f2f6f4a03f51eeef2bec Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 9 Sep 2022 06:04:02 -0400 Subject: [PATCH] *Handle edge case if we have no responses --- src/query/wisdom.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/query/wisdom.ts b/src/query/wisdom.ts index 3bfd002..fd0572a 100644 --- a/src/query/wisdom.ts +++ b/src/query/wisdom.ts @@ -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 >=