Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Cluster, Command, Redis } from 'ioredis';
import { uniq } from 'lodash';
import {
ConflictException,
Injectable,
Expand Down Expand Up @@ -37,11 +38,11 @@ export class RedisearchService {
const nodes = this.getShards(client);

const res = await Promise.all(nodes.map(async (node) => node.sendCommand(
new Command('FT._LIST'),
new Command('FT._LIST', [], { replyEncoding: 'hex' }),
)));

return plainToClass(ListRedisearchIndexesResponse, {
indexes: [].concat(...res),
indexes: (uniq([].concat(...res))).map((idx) => Buffer.from(idx, 'hex')),
});
} catch (e) {
this.logger.error('Failed to get redisearch indexes', e);
Expand Down Expand Up @@ -103,7 +104,15 @@ export class RedisearchService {
replyEncoding: 'utf8',
});

await Promise.all(nodes.map(async (node) => node.sendCommand(command)));
await Promise.all(nodes.map(async (node) => {
try {
await node.sendCommand(command);
} catch (e) {
if (!e.message.includes('MOVED')) {
throw e;
}
}
}));

return undefined;
} catch (e) {
Expand Down