Closed KJTsanaktsidis closed 7 months ago
Hey @supercaracal , any chance you could have another look at this at some point? 🙏
The idea of exposing a "watcher object" is required because redis-rb needs the ability to add keys to an existing watch connection (see https://github.com/redis/redis-rb/pull/1256/files#diff-5c5f213faec136383c1e36eea915fdd563dee2dfe74ea912574e312ae097ba6bR110).
The WATCH
functionality you added to the router here (https://github.com/redis-rb/redis-cluster-client/blob/23fd884823c009420066898bd7dc8370d656c707/lib/redis_client/cluster/router.rb#L323) is also not sufficient because it unconditionally attempts to commit the transaction; however, it's perfectly valid to watch some keys and then decide not to do a MULTI/EXEC at all after inspecting the contents of the keys.
Hopefully the fact that the watch
methods is now private in this PR means we can merge it and experiment with it on the redis-rb side for now?
I don't have a plan to implement any additional interface different from redis-client. You can use the next
statement for returning from your block. Other reasens are the same as my comments on your previous pull request.
(this is a continuation of https://github.com/redis-rb/redis-cluster-client/pull/339 )
This returns a "watcher" object, which can either be used for three things:
This means that the following pattern becomes possible in redis-cluster-client:
This interface is what's required to make redis-clustering/redis-rb work correctly, I think.