Skip to content

Commit 6cc7ba5

Browse files
committed
#RI-6624 - fix slow request for json
1 parent 1a2b12e commit 6cc7ba5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

redisinsight/api/src/modules/browser/rejson-rl/rejson-rl.service.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class RejsonRlService {
161161
path: string,
162162
type: string,
163163
): Promise<SafeRejsonRlDataDto[]> {
164-
const result = [];
164+
const promises = [];
165165
let objectKeys: string[];
166166
let arrayLength: number;
167167

@@ -174,8 +174,8 @@ export class RejsonRlService {
174174
? `['${objectKey}']`
175175
: `["${objectKey}"]`;
176176
const fullObjectKeyPath = `${rootPath}${childPath}`;
177-
result.push(
178-
await this.getDetails(
177+
promises.push(
178+
this.getDetails(
179179
client,
180180
keyName,
181181
fullObjectKeyPath,
@@ -184,26 +184,22 @@ export class RejsonRlService {
184184
);
185185
}
186186

187-
break;
187+
return Promise.all(promises);
188188
case 'array':
189189
arrayLength = await client.sendCommand([
190190
BrowserToolRejsonRlCommands.JsonArrLen,
191191
keyName,
192192
path,
193193
], { replyEncoding: 'utf8' }) as number;
194-
195194
for (let i = 0; i < arrayLength; i += 1) {
196195
const fullObjectKeyPath = `${path === '.' ? '' : path}[${i}]`;
197-
result.push(
198-
await this.getDetails(client, keyName, fullObjectKeyPath, i),
199-
);
196+
promises.push(this.getDetails(client, keyName, fullObjectKeyPath, i));
200197
}
201-
break;
198+
199+
return Promise.all(promises);
202200
default:
203201
return this.forceGetJson(client, keyName, path);
204202
}
205-
206-
return result;
207203
}
208204

209205
/**

0 commit comments

Comments
 (0)