mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Ensure PresenceChannel does not raise error during readonly (#22899)
PresenceChannel configuration is cached using redis. That cache is used, and sometimes repopulated, during normal GET requests. When the primary redis server was readonly, that `redis.set` call would raise an error and cause the entire request to fail. Instead, we should ignore the failure and continue without populating the cache.
This commit is contained in:
@@ -314,7 +314,10 @@ class PresenceChannel
|
||||
else
|
||||
raise InvalidConfig.new "Expected PresenceChannel::Config or nil. Got a #{result.class.name}"
|
||||
end
|
||||
PresenceChannel.redis.set(redis_key_config, to_cache, ex: CONFIG_CACHE_SECONDS)
|
||||
|
||||
DiscourseRedis.ignore_readonly do
|
||||
PresenceChannel.redis.set(redis_key_config, to_cache, ex: CONFIG_CACHE_SECONDS)
|
||||
end
|
||||
|
||||
raise PresenceChannel::NotFound if result.nil?
|
||||
result
|
||||
|
||||
Reference in New Issue
Block a user