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
f6aa5f9b
Commit
f6aa5f9b
authored
Nov 12, 2021
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Namespace and rename ReactiveService
https://gitlab.com/gitlab-org/gitlab/-/issues/330670#note_620149902
parent
d0871fac
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
24 deletions
+26
-24
app/models/concerns/integrations/reactively_cached.rb
app/models/concerns/integrations/reactively_cached.rb
+15
-0
app/models/concerns/reactive_service.rb
app/models/concerns/reactive_service.rb
+0
-13
app/models/integrations/bamboo.rb
app/models/integrations/bamboo.rb
+1
-1
app/models/integrations/buildkite.rb
app/models/integrations/buildkite.rb
+1
-1
app/models/integrations/drone_ci.rb
app/models/integrations/drone_ci.rb
+1
-1
app/models/integrations/teamcity.rb
app/models/integrations/teamcity.rb
+1
-1
doc/development/reactive_caching.md
doc/development/reactive_caching.md
+6
-6
ee/app/finders/projects/integrations/jira/by_ids_finder.rb
ee/app/finders/projects/integrations/jira/by_ids_finder.rb
+1
-1
No files found.
app/models/concerns/integrations/reactively_cached.rb
0 → 100644
View file @
f6aa5f9b
# frozen_string_literal: true
module
Integrations
module
ReactivelyCached
extend
ActiveSupport
::
Concern
included
do
include
::
ReactiveCaching
# Default cache key: class name + project_id
self
.
reactive_cache_key
=
->
(
integration
)
{
[
integration
.
class
.
model_name
.
singular
,
integration
.
project_id
]
}
self
.
reactive_cache_work_type
=
:external_dependency
end
end
end
app/models/concerns/reactive_service.rb
deleted
100644 → 0
View file @
d0871fac
# frozen_string_literal: true
module
ReactiveService
extend
ActiveSupport
::
Concern
included
do
include
ReactiveCaching
# Default cache key: class name + project_id
self
.
reactive_cache_key
=
->
(
service
)
{
[
service
.
class
.
model_name
.
singular
,
service
.
project_id
]
}
self
.
reactive_cache_work_type
=
:external_dependency
end
end
app/models/integrations/bamboo.rb
View file @
f6aa5f9b
...
...
@@ -3,7 +3,7 @@
module
Integrations
class
Bamboo
<
BaseCi
include
ActionView
::
Helpers
::
UrlHelper
include
Reactive
Service
include
Reactive
lyCached
prop_accessor
:bamboo_url
,
:build_key
,
:username
,
:password
...
...
app/models/integrations/buildkite.rb
View file @
f6aa5f9b
...
...
@@ -5,7 +5,7 @@ require "addressable/uri"
module
Integrations
class
Buildkite
<
BaseCi
include
HasWebHook
include
Reactive
Service
include
Reactive
lyCached
extend
Gitlab
::
Utils
::
Override
ENDPOINT
=
"https://buildkite.com"
...
...
app/models/integrations/drone_ci.rb
View file @
f6aa5f9b
...
...
@@ -3,7 +3,7 @@
module
Integrations
class
DroneCi
<
BaseCi
include
HasWebHook
include
Reactive
Service
include
Reactive
lyCached
include
ServicePushDataValidations
extend
Gitlab
::
Utils
::
Override
...
...
app/models/integrations/teamcity.rb
View file @
f6aa5f9b
...
...
@@ -2,7 +2,7 @@
module
Integrations
class
Teamcity
<
BaseCi
include
Reactive
Service
include
Reactive
lyCached
include
ServicePushDataValidations
prop_accessor
:teamcity_url
,
:build_type
,
:username
,
:password
...
...
doc/development/reactive_caching.md
View file @
f6aa5f9b
...
...
@@ -74,7 +74,7 @@ For more information, read the internal issue
### In models and integrations
The ReactiveCaching concern can be used in models as well as
`integrations`
The ReactiveCaching concern can be used in models as well as
integrations
(
`app/models/integrations`
).
1.
Include the concern in your model or integration.
...
...
@@ -88,7 +88,7 @@ The ReactiveCaching concern can be used in models as well as `integrations`
To include the concern in an integration:
```
ruby
include
ReactiveService
include
Integrations
::
ReactivelyCached
```
1.
Implement the
`calculate_reactive_cache`
method in your model or integration.
...
...
@@ -201,15 +201,15 @@ There are some `class_attribute` options which can be tweaked.
and
`"ExampleModel:1:arg1:arg2:alive"`
respectively, where
`ExampleModel`
is the
name of the model,
`1`
is the ID of the record,
`arg1`
and
`arg2`
are parameters
passed to
`with_reactive_cache`
.
-
If you're including this concern in a
service
instead, you must override
the default by adding the following to your
service
:
-
If you're including this concern in a
n integration (
`app/models/integrations/`
)
instead, you must override
the default by adding the following to your
integration
:
```
ruby
self
.
reactive_cache_key
=
->
(
service
)
{
[
service
.
class
.
model_name
.
singular
,
service
.
project_id
]
}
self
.
reactive_cache_key
=
->
(
integration
)
{
[
integration
.
class
.
model_name
.
singular
,
integration
.
project_id
]
}
```
If your reactive_cache_key is exactly like the above, you can use the existing
`
ReactiveService
`
concern instead.
`
Integrations::ReactivelyCached
`
concern instead.
#### `self.reactive_cache_lease_timeout`
...
...
ee/app/finders/projects/integrations/jira/by_ids_finder.rb
View file @
f6aa5f9b
...
...
@@ -4,7 +4,7 @@ module Projects
module
Integrations
module
Jira
class
ByIdsFinder
include
ReactiveService
include
::
Integrations
::
ReactivelyCached
self
.
reactive_cache_key
=
->
(
finder
)
{
[
finder
.
model_name
]
}
self
.
reactive_cache_work_type
=
:external_dependency
...
...
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