You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
@@ -93,10 +93,10 @@ export class RedisSentinelClient<
|
|||||||
RESP extends RespVersions = 2,
|
RESP extends RespVersions = 2,
|
||||||
TYPE_MAPPING extends TypeMapping = {}
|
TYPE_MAPPING extends TypeMapping = {}
|
||||||
>(
|
>(
|
||||||
|
options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>,
|
||||||
internal: RedisSentinelInternal<M, F, S, RESP, TYPE_MAPPING>,
|
internal: RedisSentinelInternal<M, F, S, RESP, TYPE_MAPPING>,
|
||||||
clientInfo: ClientInfo,
|
clientInfo: ClientInfo,
|
||||||
commandOptions?: CommandOptions<TYPE_MAPPING>,
|
commandOptions?: CommandOptions<TYPE_MAPPING>,
|
||||||
options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>
|
|
||||||
) {
|
) {
|
||||||
return RedisSentinelClient.factory(options)(internal, clientInfo, commandOptions);
|
return RedisSentinelClient.factory(options)(internal, clientInfo, commandOptions);
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ export default class RedisSentinel<
|
|||||||
|
|
||||||
this.#options = options;
|
this.#options = options;
|
||||||
|
|
||||||
if (options?.commandOptions) {
|
if (options.commandOptions) {
|
||||||
this.#commandOptions = options.commandOptions;
|
this.#commandOptions = options.commandOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ export default class RedisSentinel<
|
|||||||
|
|
||||||
Sentinel.prototype.Multi = RedisSentinelMultiCommand.extend(config);
|
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"
|
// 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>;
|
return Object.create(new Sentinel(options)) as RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>;
|
||||||
};
|
};
|
||||||
@@ -319,7 +319,7 @@ export default class RedisSentinel<
|
|||||||
S extends RedisScripts = {},
|
S extends RedisScripts = {},
|
||||||
RESP extends RespVersions = 2,
|
RESP extends RespVersions = 2,
|
||||||
TYPE_MAPPING extends TypeMapping = {}
|
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);
|
return RedisSentinel.factory(options)(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ export default class RedisSentinel<
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return await fn(
|
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 {
|
} finally {
|
||||||
const promise = this._self.#internal.releaseClientLease(clientInfo);
|
const promise = this._self.#internal.releaseClientLease(clientInfo);
|
||||||
@@ -510,7 +510,7 @@ export default class RedisSentinel<
|
|||||||
|
|
||||||
async aquire(): Promise<RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>> {
|
async aquire(): Promise<RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>> {
|
||||||
const clientInfo = await this._self.#internal.getClientLease();
|
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 {
|
getSentinelNode(): RedisNode | undefined {
|
||||||
|
@@ -29,14 +29,16 @@ export interface RedisSentinelOptions<
|
|||||||
* The maximum number of times a command will retry due to topology changes.
|
* The maximum number of times a command will retry due to topology changes.
|
||||||
*/
|
*/
|
||||||
maxCommandRediscovers?: number;
|
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
|
* 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
|
* 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
|
* The number of clients connected to the master node
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user