You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
[CAE-342] Some tests
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -404,14 +404,15 @@ export default class RedisSentinel<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async use<T>(fn: (sentinelClient: RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>) => Promise<T>) {
|
async use<T>(id: string, fn: (sentinelClient: RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>) => Promise<T>) {
|
||||||
const clientInfo = await this._self.#internal.getClientLease();
|
const clientInfo = await this._self.#internal.getClientLease();
|
||||||
|
console.log("leased client: %d from %s", clientInfo.id, id)
|
||||||
try {
|
try {
|
||||||
return await fn(
|
return await fn(
|
||||||
RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions)
|
RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions)
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
|
console.log("released client: %d from %s", clientInfo.id, id)
|
||||||
const promise = this._self.#internal.releaseClientLease(clientInfo);
|
const promise = this._self.#internal.releaseClientLease(clientInfo);
|
||||||
if (promise) await promise;
|
if (promise) await promise;
|
||||||
}
|
}
|
||||||
@@ -735,7 +736,7 @@ class RedisSentinelInternal<
|
|||||||
}
|
}
|
||||||
const sockOpts = client.options?.socket as TcpNetConnectOpts | undefined;
|
const sockOpts = client.options?.socket as TcpNetConnectOpts | undefined;
|
||||||
this.#trace("attemping to send command to " + sockOpts?.host + ":" + sockOpts?.port)
|
this.#trace("attemping to send command to " + sockOpts?.host + ":" + sockOpts?.port)
|
||||||
|
console.log("attempting to send command to %s:%s from %s", sockOpts?.host, sockOpts?.port, clientInfo?.id)
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
// force testing of READONLY errors
|
// force testing of READONLY errors
|
||||||
|
Reference in New Issue
Block a user