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
3011d182
Commit
3011d182
authored
Aug 14, 2019
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make `Ci::Group` to be efficient
parent
08f22901
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
app/models/ci/group.rb
app/models/ci/group.rb
+6
-1
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+1
-1
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+2
-0
lib/gitlab/ci/status/grouped_statuses.rb
lib/gitlab/ci/status/grouped_statuses.rb
+6
-3
No files found.
app/models/ci/group.rb
View file @
3011d182
...
...
@@ -9,6 +9,7 @@ module Ci
#
class
Group
include
StaticModel
include
Gitlab
::
Utils
::
StrongMemoize
attr_reader
:stage
,
:name
,
:jobs
...
...
@@ -21,7 +22,11 @@ module Ci
end
def
status
@status
||=
commit_statuses
.
status
strong_memoize
(
:status
)
do
Gitlab
::
Ci
::
Status
::
GroupedStatuses
.
new
(
@jobs
)
.
one
[
:status
]
end
end
def
detailed_status
(
current_user
)
...
...
app/models/concerns/has_status.rb
View file @
3011d182
...
...
@@ -21,7 +21,7 @@ module HasStatus
def
status
Gitlab
::
Ci
::
Status
::
GroupedStatuses
.
new
(
all
)
.
one
&
.
dig
(
:status
)
.
one
[
:status
]
end
def
started_at
...
...
app/services/ci/process_pipeline_service.rb
View file @
3011d182
...
...
@@ -2,6 +2,8 @@
module
Ci
class
ProcessPipelineService
<
BaseService
include
Gitlab
::
Utils
::
StrongMemoize
attr_reader
:pipeline
def
execute
(
pipeline
,
trigger_build_ids
=
nil
)
...
...
lib/gitlab/ci/status/grouped_statuses.rb
View file @
3011d182
...
...
@@ -12,8 +12,11 @@ module Gitlab
def
one
(
**
query
)
validate_keys!
(
query
.
keys
)
item_hash
=
find_one
(
data_hash
,
query
)
status_for_key
(
query
,
item_hash
)
if
item_hash
if
item_hash
=
find_one
(
data_hash
,
query
)
status_for_key
(
query
,
item_hash
)
else
{}
end
end
def
group
(
*
keys
)
...
...
@@ -42,7 +45,7 @@ module Gitlab
# we request allow_failure when
# we don't have column_names, or such column does exist
columns
<<
:allow_failure
if
!
subject
.
respond_to?
(
:column_names
)
||
subject
.
column_names
.
include?
(
'allow_failure'
)
subject
.
pluck
(
*
columns
)
.
map
{
|
attrs
|
columns
.
zip
(
attrs
).
to_h
}
...
...
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