Skip to content

Commit

Permalink
Merge pull request #710 from naveen-chidhambaram/main
Browse files Browse the repository at this point in the history
CROSSSLOT keys issue fix when using redis cluster
  • Loading branch information
andrehjr authored Jul 25, 2023
2 parents a2190bb + 4ae6399 commit 77d482b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/split/redis_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def persist_list(list_name, list_values)
if list_values.length > 0
redis.multi do |multi|
tmp_list = "#{list_name}_tmp"
tmp_list += redis_namespace_used? ? "{#{Split.redis.namespace}:#{list_name}}" : "{#{list_name}}"
multi.rpush(tmp_list, list_values)
multi.rename(tmp_list, list_name)
end
Expand All @@ -27,5 +28,9 @@ def add_to_set(set_name, value)

private
attr_accessor :redis

def redis_namespace_used?
Redis.const_defined?("Namespace") && Split.redis.is_a?(Redis::Namespace)
end
end
end

0 comments on commit 77d482b

Please sign in to comment.