NodeSelection dispatch
output gets reused
#1876
Labels
type: enhancement
A general enhancement
Milestone
dispatch
output gets reused
#1876
Discussed in #1875
Originally posted by seeday October 6, 2021
I'm attempting to broadcast commands to all the replicas in a Redis Cluster deployment, but I'm seeing some weird behavior. Code is below. Redis 6.0.9 and Lettuce 6.1.5.
doThing
anddoThing3
work just fine, however I feel likedoThing2
should also work, and I don't quite understand why. The results fromdoThing2
return jumbled up, weirdly nested, and out of order, like there's multiple threads fighting over the singleNestedMultiOutput
. I've tried several ways of synchronizing aNestedMultiOutput
, but neither locks nor threadlocals work properly.While 3 does work, (specifically for custom commands), I'm curious as to what option 1 is doing to synchronize the responses properly, why option 2 is not equivalent to 1, and if it's doing it faster than my mess of
CompletableFuture
s in option 3.Thanks!
We need to document that
dispatch
cannot be used in its regular form as theCommandOutput
is shared across connections and that messes up the result. We should also throw an exception there and consider adispatch
variant accepting aSupplier
.The text was updated successfully, but these errors were encountered: