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
7f669ae8
Commit
7f669ae8
authored
Dec 20, 2021
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read running builds from denormalized table upon assignment
Changelog: performance
parent
ef987699
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
lib/gitlab/ci/queue/metrics.rb
lib/gitlab/ci/queue/metrics.rb
+17
-3
No files found.
lib/gitlab/ci/queue/metrics.rb
View file @
7f669ae8
...
...
@@ -74,12 +74,26 @@ module Gitlab
return
'+Inf'
unless
runner
.
instance_type?
# excluding currently started job
running_jobs_count
=
job
.
project
.
builds
.
running
.
where
(
runner:
::
Ci
::
Runner
.
instance_type
)
.
limit
(
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
+
1
).
count
-
1
running_jobs_count
<
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
?
running_jobs_count
:
"
#{
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
}
+"
running_jobs_count
=
running_jobs_relation
(
job
)
.
where
(
runner:
::
Ci
::
Runner
.
instance_type
)
.
limit
(
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
+
1
).
count
-
1
if
running_jobs_count
<
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
running_jobs_count
else
"
#{
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET
}
+"
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
running_jobs_relation
(
job
)
if
::
Feature
.
enabled?
(
:ci_pending_builds_maintain_denormalized_data
,
default_enabled: :yaml
)
::
Ci
::
RunningBuild
.
where
(
project_id:
job
.
project
.
id
)
else
job
.
project
.
builds
.
running
end
end
def
increment_queue_operation
(
operation
)
self
.
class
.
increment_queue_operation
(
operation
)
end
...
...
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