Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions packages/client/lib/sentinel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export class RedisSentinelClient<
RESP extends RespVersions = 2,
TYPE_MAPPING extends TypeMapping = {}
>(
options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>,
internal: RedisSentinelInternal<M, F, S, RESP, TYPE_MAPPING>,
clientInfo: ClientInfo,
commandOptions?: CommandOptions<TYPE_MAPPING>,
options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>
) {
return RedisSentinelClient.factory(options)(internal, clientInfo, commandOptions);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ export default class RedisSentinel<

this.#options = options;

if (options?.commandOptions) {
if (options.commandOptions) {
this.#commandOptions = options.commandOptions;
}

Expand Down Expand Up @@ -307,7 +307,7 @@ export default class RedisSentinel<

Sentinel.prototype.Multi = RedisSentinelMultiCommand.extend(config);

return (options?: Omit<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => {
return (options: Omit<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => {
// returning a "proxy" to prevent the namespaces.self to leak between "proxies"
return Object.create(new Sentinel(options)) as RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>;
};
Expand All @@ -319,7 +319,7 @@ export default class RedisSentinel<
S extends RedisScripts = {},
RESP extends RespVersions = 2,
TYPE_MAPPING extends TypeMapping = {}
>(options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {
>(options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {
return RedisSentinel.factory(options)(options);
}

Expand Down Expand Up @@ -409,7 +409,7 @@ export default class RedisSentinel<

try {
return await fn(
RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options)
RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions)
);
} finally {
const promise = this._self.#internal.releaseClientLease(clientInfo);
Expand Down Expand Up @@ -510,7 +510,7 @@ export default class RedisSentinel<

async aquire(): Promise<RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>> {
const clientInfo = await this._self.#internal.getClientLease();
return RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options);
return RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions);
}

getSentinelNode(): RedisNode | undefined {
Expand Down
6 changes: 4 additions & 2 deletions packages/client/lib/sentinel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ export interface RedisSentinelOptions<
* The maximum number of times a command will retry due to topology changes.
*/
maxCommandRediscovers?: number;
// TODO: omit properties that users shouldn't be able to specify for sentinel at this level
/**
* The configuration values for every node in the cluster. Use this for example when specifying an ACL user to connect with
*/
nodeClientOptions?: RedisClientOptions<M, F, S, RESP, TYPE_MAPPING, RedisTcpSocketOptions>;
nodeClientOptions?: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts, RESP, TYPE_MAPPING, RedisTcpSocketOptions>;
// TODO: omit properties that users shouldn't be able to specify for sentinel at this level
/**
* The configuration values for every sentinel in the cluster. Use this for example when specifying an ACL user to connect with
*/
sentinelClientOptions?: RedisClientOptions<M, F, S, RESP, TYPE_MAPPING, RedisTcpSocketOptions>;
sentinelClientOptions?: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts, RESP, TYPE_MAPPING, RedisTcpSocketOptions>;
/**
* The number of clients connected to the master node
*/
Expand Down
Loading