summaryrefslogtreecommitdiff
path: root/app/models/broadcast_message.rb
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-04-11 10:49:56 -0700
committerMichael Kozono <mkozono@gmail.com>2018-04-11 11:28:44 -0700
commit1ce0595b18e3cb4caa551f9f0f03b264adb1e70e (patch)
tree7ba1688a232780ae8f51f398c8b82878256921e7 /app/models/broadcast_message.rb
parent37a5632483b67ddcfa4c535cc911319b25f01fb5 (diff)
downloadgitlab-ce-1ce0595b18e3cb4caa551f9f0f03b264adb1e70e.tar.gz
Backport: Propagate broadcast messages to secondaries
Diffstat (limited to 'app/models/broadcast_message.rb')
-rw-r--r--app/models/broadcast_message.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb
index 0b561203914..4aa236555cb 100644
--- a/app/models/broadcast_message.rb
+++ b/app/models/broadcast_message.rb
@@ -19,7 +19,7 @@ class BroadcastMessage < ActiveRecord::Base
after_commit :flush_redis_cache
def self.current
- messages = Rails.cache.fetch(CACHE_KEY) { current_and_future_messages.to_a }
+ messages = Rails.cache.fetch(CACHE_KEY, expires_in: cache_expires_in) { current_and_future_messages.to_a }
return messages if messages.empty?
@@ -36,6 +36,10 @@ class BroadcastMessage < ActiveRecord::Base
where('ends_at > :now', now: Time.zone.now).order_id_asc
end
+ def self.cache_expires_in
+ nil
+ end
+
def active?
started? && !ended?
end