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
584f7d0a
Commit
584f7d0a
authored
Dec 15, 2021
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use_upsert_query_for_mr_metrics FF
parent
ee0346bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
32 deletions
+1
-32
app/models/merge_request.rb
app/models/merge_request.rb
+1
-24
config/feature_flags/development/use_upsert_query_for_mr_metrics.yml
...ure_flags/development/use_upsert_query_for_mr_metrics.yml
+0
-8
No files found.
app/models/merge_request.rb
View file @
584f7d0a
...
@@ -1884,30 +1884,7 @@ class MergeRequest < ApplicationRecord
...
@@ -1884,30 +1884,7 @@ class MergeRequest < ApplicationRecord
override
:ensure_metrics
override
:ensure_metrics
def
ensure_metrics
def
ensure_metrics
if
Feature
.
enabled?
(
:use_upsert_query_for_mr_metrics
,
default_enabled: :yaml
)
MergeRequest
::
Metrics
.
record!
(
self
)
MergeRequest
::
Metrics
.
record!
(
self
)
else
# Backward compatibility: some merge request metrics records will not have target_project_id filled in.
# In that case the first `safe_find_or_create_by` will return false.
# The second finder call will be eliminated in https://gitlab.com/gitlab-org/gitlab/-/issues/233507
metrics_record
=
MergeRequest
::
Metrics
.
safe_find_or_create_by
(
merge_request_id:
id
,
target_project_id:
target_project_id
)
||
MergeRequest
::
Metrics
.
safe_find_or_create_by
(
merge_request_id:
id
)
metrics_record
.
tap
do
|
metrics_record
|
# Make sure we refresh the loaded association object with the newly created/loaded item.
# This is needed in order to have the exact functionality than before.
#
# Example:
#
# merge_request.metrics.destroy
# merge_request.ensure_metrics
# merge_request.metrics # should return the metrics record and not nil
# merge_request.metrics.merge_request # should return the same MR record
metrics_record
.
target_project_id
=
target_project_id
metrics_record
.
association
(
:merge_request
).
target
=
self
association
(
:metrics
).
target
=
metrics_record
end
end
end
end
def
allows_reviewers?
def
allows_reviewers?
...
...
config/feature_flags/development/use_upsert_query_for_mr_metrics.yml
deleted
100644 → 0
View file @
ee0346bf
---
name
:
use_upsert_query_for_mr_metrics
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69240
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/339677
milestone
:
'
14.3'
type
:
development
group
:
group::optimize
default_enabled
:
true
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