diff options
author | Nick Thomas <nick@gitlab.com> | 2018-04-11 22:04:10 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-04-11 22:04:10 +0300 |
commit | 84c70f4335e1b4f496f29cb99cc7fdaf926a5571 (patch) | |
tree | 7d6e86b43644076bfb007d07e0cab491f843a984 /app/models | |
parent | 9f8d91c94e6ad41c970931d5eab6948fad31187b (diff) | |
parent | 1ce0595b18e3cb4caa551f9f0f03b264adb1e70e (diff) |
Merge branch 'mk/geo/backport-broadcast-message-cache-expiration-hook' into 'master'
[CE Backport] Propagate broadcast messages to secondaries
See merge request gitlab-org/gitlab-ce!18324
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/broadcast_message.rb | 6 |
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 |