1
0
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:
H. Temelski
2025-03-07 17:16:39 +02:00
parent d2544201fd
commit 32048199eb
2 changed files with 853 additions and 842 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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();
console.log("leased client: %d from %s", clientInfo.id, id)
try {
return await fn(
RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions)
);
} finally {
console.log("released client: %d from %s", clientInfo.id, id)
const promise = this._self.#internal.releaseClientLease(clientInfo);
if (promise) await promise;
}
@@ -735,7 +736,7 @@ class RedisSentinelInternal<
}
const sockOpts = client.options?.socket as TcpNetConnectOpts | undefined;
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 {
/*
// force testing of READONLY errors