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
156baa54
Commit
156baa54
authored
Jan 17, 2020
by
Sean Arnold
Committed by
Douglas Barbosa Alexandre
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear list issue cache after issue update
- add clear_cache method to error tracking setting
parent
1ec39914
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
0 deletions
+34
-0
app/models/error_tracking/project_error_tracking_setting.rb
app/models/error_tracking/project_error_tracking_setting.rb
+7
-0
app/services/error_tracking/issue_update_service.rb
app/services/error_tracking/issue_update_service.rb
+5
-0
spec/models/error_tracking/project_error_tracking_setting_spec.rb
...els/error_tracking/project_error_tracking_setting_spec.rb
+14
-0
spec/services/error_tracking/issue_update_service_spec.rb
spec/services/error_tracking/issue_update_service_spec.rb
+8
-0
No files found.
app/models/error_tracking/project_error_tracking_setting.rb
View file @
156baa54
...
...
@@ -140,6 +140,13 @@ module ErrorTracking
Addressable
::
URI
.
join
(
api_url
,
'/'
).
to_s
end
def
clear_cache
(
key_prefix
)
return
unless
key_prefix
klass_key
=
self
.
class
.
reactive_cache_key
.
call
(
self
).
join
(
':'
)
Rails
.
cache
.
delete_matched
(
"
#{
klass_key
}
:
#{
key_prefix
}
*"
)
end
private
def
add_gitlab_issue_details
(
issue
)
...
...
app/services/error_tracking/issue_update_service.rb
View file @
156baa54
...
...
@@ -9,6 +9,7 @@ module ErrorTracking
unless
parse_errors
(
response
).
present?
response
[
:closed_issue_iid
]
=
update_related_issue
&
.
iid
clear_cache
end
response
...
...
@@ -28,6 +29,10 @@ module ErrorTracking
close_and_create_note
(
issue
)
end
def
clear_cache
project_error_tracking_setting
.
clear_cache
(
'list_issues'
)
end
def
close_and_create_note
(
issue
)
return
unless
resolving?
&&
issue
.
opened?
...
...
spec/models/error_tracking/project_error_tracking_setting_spec.rb
View file @
156baa54
...
...
@@ -440,4 +440,18 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end
end
end
describe
'#clear_cache'
do
let
(
:key_prefix
)
{
'list_issues'
}
it
'clears the cache'
do
klass_key
=
subject
.
class
.
reactive_cache_key
.
call
(
subject
).
join
(
':'
)
expect
(
Rails
.
cache
)
.
to
receive
(
:delete_matched
)
.
with
(
"
#{
klass_key
}
:
#{
key_prefix
}
*"
)
subject
.
clear_cache
(
key_prefix
)
end
end
end
spec/services/error_tracking/issue_update_service_spec.rb
View file @
156baa54
...
...
@@ -40,6 +40,14 @@ describe ErrorTracking::IssueUpdateService do
result
end
it
'clears the reactive cache'
do
expect
(
error_tracking_setting
)
.
to
receive
(
:clear_cache
)
.
with
(
'list_issues'
)
result
end
context
'related issue and resolving'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:sentry_issue
)
{
create
(
:sentry_issue
,
issue:
issue
)
}
...
...
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