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
595d0b32
Commit
595d0b32
authored
Aug 18, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split for_project_paths into two queries
Changelog: changed
parent
85344d09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
app/models/commit_status.rb
app/models/commit_status.rb
+5
-1
No files found.
app/models/commit_status.rb
View file @
595d0b32
...
...
@@ -63,8 +63,12 @@ class CommitStatus < Ci::ApplicationRecord
where
(
'(ci_builds.created_at BETWEEN ? AND ?) AND (ci_builds.updated_at BETWEEN ? AND ?)'
,
lookback
,
timeout
,
lookback
,
timeout
)
}
# The scope applies `pluck` to split the queries. Use with care.
scope
:for_project_paths
,
->
(
paths
)
do
where
(
project:
Project
.
where_full_path_in
(
Array
(
paths
)))
# Pluck is used to split this query. Splitting the query is required for database decomposition for `ci_*` tables.
# https://docs.gitlab.com/ee/development/database/transaction_guidelines.html#database-decomposition-and-sharding
project_ids
=
Project
.
where_full_path_in
(
Array
(
paths
)).
pluck
(
:id
)
where
(
project:
project_ids
)
end
scope
:with_preloads
,
->
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