Skip to content

Conversation

@stijnveenman
Copy link
Contributor

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. redis/node-redis#2657
So this also adds a custom implementation that calls scanIterator on each node of the cluster, and yiels all keys from each node.

@wavded
Copy link
Collaborator

wavded commented Apr 9, 2025

Thx for working on this @stijnveenman , can you fix up the formatting, then I think it's ready to go.

@stijnveenman
Copy link
Contributor Author

@wavded should be fixed now

@wavded wavded added the bug label Apr 10, 2025
@wavded wavded self-assigned this Apr 10, 2025
@wavded wavded merged commit c70b9d6 into tj:master Apr 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants