BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1ce0595b
Commit
1ce0595b
authored
Apr 11, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport: Propagate broadcast messages to secondaries
parent
37a56324
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
broadcast_message.rb
app/models/broadcast_message.rb
+5
-1
broadcast_message_spec.rb
spec/models/broadcast_message_spec.rb
+5
-1
No files found.
app/models/broadcast_message.rb
View file @
1ce0595b
...
...
@@ -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
...
...
spec/models/broadcast_message_spec.rb
View file @
1ce0595b
...
...
@@ -51,7 +51,11 @@ describe BroadcastMessage do
expect
(
described_class
).
to
receive
(
:where
).
and_call_original
.
once
2
.
times
{
described_class
.
current
}
described_class
.
current
Timecop
.
travel
(
1
.
year
)
do
described_class
.
current
end
end
it
'includes messages that need to be displayed in the future'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment