ITADN

Fix `node-redis` `createCluster` normalized client

#427Pull Requeststijnveenman 创建于 2025-04-09
S
stijnveenmancommented
# Background When using `node-redis`, a client can be created using `createClient` and `createCluster`. When `createCluster` is used, `scanIterator` is not part of the cluster client, and cannot be called from the root. This caused our `TTL` not to be set, as `isRedis` would be false, which would cause the `redis-io` arguments to be used. Next to that, if `scanIterator` would be called with the current implementation when using a cluster, it would crash. As neither the `io-redis` implementation nor the `scanIterator` can be used. # Fix We also set `isRedis` to true when `"masters" in client`, which can be used to check whether `createCluster` was used. This fixed the mget and set behaviour, as now the correct `node-redis` implementation is used. This does not fix `scanIterator` yet, as this cannot be called from the root. https://github.com/redis/node-redis/issues/2657 So this also adds a custom implementation that calls `scanIterator` on each node of the cluster, and yiels all keys from each node.
合并状态:未合并 2 条评论