A platform for community discussion. Free, open, simple.
DEV: Fix implementation for `DiscourseRedis#exists`.
Guo Xiang Tan389bdcf5ab1b
diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rbindex 5ef5de9ce9d..e273810a3c7 100644--- a/lib/discourse_redis.rb+++ b/lib/discourse_redis.rb@@ -208,13 +208,15 @@ class DiscourseRedisendend- # Remove when this has been upstreamed in https://github.com/redis/redis-rb/pull/911+ # Implement our own because https://github.com/redis/redis-rb/issues/698 has stalleddef exists(*keys)keys.map! { |a| "#{namespace}:#{a}" } if @namespaceDiscourseRedis.ignore_readonly do- @redis._client.call([:exists, *keys]) do |value|- value > 0+ @redis.synchronize do |client|+ client.call([:exists, *keys]) do |value|+ value > 0+ endendendenddiff --git a/spec/components/discourse_redis_spec.rb b/spec/components/discourse_redis_spec.rbindex 059e1449628..8e4411653bd 100644--- a/spec/components/discourse_redis_spec.rb+++ b/spec/components/discourse_redis_spec.rb@@ -88,7 +88,6 @@ describe DiscourseRedis doendend- # Remove when this has been upstreamed in https://github.com/redis/redis-rb/pull/911describe '.exists' doit 'should return false when key is not present' doexpect(Discourse.redis.exists('test')).to eq(false)