Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f989aaa3
Commit
f989aaa3
authored
Jun 11, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
51176830
83d8af24
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
5 deletions
+15
-5
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+0
-1
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+0
-1
app/models/concerns/prometheus_adapter.rb
app/models/concerns/prometheus_adapter.rb
+0
-1
app/models/concerns/reactive_caching.rb
app/models/concerns/reactive_caching.rb
+2
-2
spec/models/concerns/reactive_caching_spec.rb
spec/models/concerns/reactive_caching_spec.rb
+13
-0
No files found.
app/models/clusters/cluster.rb
View file @
f989aaa3
...
...
@@ -8,7 +8,6 @@ module Clusters
include
ReactiveCaching
self
.
table_name
=
'clusters'
self
.
reactive_cache_key
=
->
(
cluster
)
{
[
cluster
.
class
.
model_name
.
singular
,
cluster
.
id
]
}
PROJECT_ONLY_APPLICATIONS
=
{
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
,
...
...
app/models/clusters/platforms/kubernetes.rb
View file @
f989aaa3
...
...
@@ -11,7 +11,6 @@ module Clusters
RESERVED_NAMESPACES
=
%w(gitlab-managed-apps)
.
freeze
self
.
table_name
=
'cluster_platforms_kubernetes'
self
.
reactive_cache_key
=
->
(
kubernetes
)
{
[
kubernetes
.
class
.
model_name
.
singular
,
kubernetes
.
id
]
}
belongs_to
:cluster
,
inverse_of: :platform_kubernetes
,
class_name:
'Clusters::Cluster'
...
...
app/models/concerns/prometheus_adapter.rb
View file @
f989aaa3
...
...
@@ -8,7 +8,6 @@ module PrometheusAdapter
# We can't prepend outside of this model due to the use of `included`, so this must stay here.
prepend
EE
::
PrometheusAdapter
# rubocop: disable Cop/InjectEnterpriseEditionModule
self
.
reactive_cache_key
=
->
(
adapter
)
{
[
adapter
.
class
.
model_name
.
singular
,
adapter
.
id
]
}
self
.
reactive_cache_lease_timeout
=
30
.
seconds
self
.
reactive_cache_refresh_interval
=
30
.
seconds
self
.
reactive_cache_lifetime
=
1
.
minute
...
...
app/models/concerns/reactive_caching.rb
View file @
f989aaa3
...
...
@@ -10,8 +10,6 @@
# class Foo < ApplicationRecord
# include ReactiveCaching
#
# self.reactive_cache_key = ->(thing) { ["foo", thing.id] }
#
# after_save :clear_reactive_cache!
#
# def calculate_reactive_cache
...
...
@@ -89,6 +87,8 @@ module ReactiveCaching
class_attribute
:reactive_cache_worker_finder
# defaults
self
.
reactive_cache_key
=
->
(
record
)
{
[
model_name
.
singular
,
record
.
id
]
}
self
.
reactive_cache_lease_timeout
=
2
.
minutes
self
.
reactive_cache_refresh_interval
=
1
.
minute
...
...
spec/models/concerns/reactive_caching_spec.rb
View file @
f989aaa3
...
...
@@ -232,4 +232,17 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
end
end
end
describe
'default options'
do
let
(
:cached_class
)
{
Class
.
new
{
include
ReactiveCaching
}
}
subject
{
cached_class
.
new
}
it
{
expect
(
subject
.
reactive_cache_lease_timeout
).
to
be_a
(
ActiveSupport
::
Duration
)
}
it
{
expect
(
subject
.
reactive_cache_refresh_interval
).
to
be_a
(
ActiveSupport
::
Duration
)
}
it
{
expect
(
subject
.
reactive_cache_lifetime
).
to
be_a
(
ActiveSupport
::
Duration
)
}
it
{
expect
(
subject
.
reactive_cache_key
).
to
respond_to
(
:call
)
}
it
{
expect
(
subject
.
reactive_cache_worker_finder
).
to
respond_to
(
:call
)
}
end
end
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