1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix socket type issues

This commit is contained in:
Leibale
2024-02-15 09:57:25 -05:00
parent cc85112e54
commit 2309d09ca1
3 changed files with 68 additions and 76 deletions

View File

@@ -5,6 +5,7 @@ import { EventEmitter } from 'node:stream';
import { ChannelListeners, PUBSUB_TYPE, PubSubTypeListeners } from '../client/pub-sub';
import { RedisArgument, RedisFunctions, RedisModules, RedisScripts, RespVersions, TypeMapping } from '../RESP/types';
import calculateSlot from 'cluster-key-slot';
import { RedisSocketOptions } from '../client/socket';
interface NodeAddress {
host: string;
@@ -102,8 +103,8 @@ export default class RedisClusterSlots<
> {
static #SLOTS = 16384;
readonly #options: RedisClusterOptions<M, F, S, RESP, TYPE_MAPPING>;
readonly #clientFactory: ReturnType<typeof RedisClient.factory<M, F, S, RESP>>;
readonly #options;
readonly #clientFactory;
readonly #emit: EventEmitter['emit'];
slots = new Array<Shard<M, F, S, RESP, TYPE_MAPPING>>(RedisClusterSlots.#SLOTS);
masters = new Array<MasterNode<M, F, S, RESP, TYPE_MAPPING>>();
@@ -271,7 +272,7 @@ export default class RedisClusterSlots<
return {
...this.#options.defaults,
...options,
socket
socket: socket as RedisSocketOptions
};
}
@@ -316,8 +317,7 @@ export default class RedisClusterSlots<
host: node.host,
port: node.port
},
readonly,
RESP: this.#options.RESP
readonly
})
).on('error', err => console.error(err));
}