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
26f0ba34
Commit
26f0ba34
authored
Sep 08, 2021
by
Thong Kuah
Committed by
Vasilii Iakliushin
Sep 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert out eager loading for ExpireJobCacheWorker
parent
cf825e60
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
21 deletions
+1
-21
app/models/commit_status.rb
app/models/commit_status.rb
+0
-1
app/workers/expire_job_cache_worker.rb
app/workers/expire_job_cache_worker.rb
+1
-1
spec/support/database/cross-join-allowlist.yml
spec/support/database/cross-join-allowlist.yml
+0
-1
spec/workers/expire_job_cache_worker_spec.rb
spec/workers/expire_job_cache_worker_spec.rb
+0
-18
No files found.
app/models/commit_status.rb
View file @
26f0ba34
...
...
@@ -56,7 +56,6 @@ class CommitStatus < Ci::ApplicationRecord
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
scope
:by_name
,
->
(
name
)
{
where
(
name:
name
)
}
scope
:in_pipelines
,
->
(
pipelines
)
{
where
(
pipeline:
pipelines
)
}
scope
:eager_load_pipeline
,
->
{
eager_load
(
:pipeline
,
project:
{
namespace: :route
})
}
scope
:with_pipeline
,
->
{
joins
(
:pipeline
)
}
scope
:updated_at_before
,
->
(
date
)
{
where
(
'ci_builds.updated_at < ?'
,
date
)
}
scope
:created_at_before
,
->
(
date
)
{
where
(
'ci_builds.created_at < ?'
,
date
)
}
...
...
app/workers/expire_job_cache_worker.rb
View file @
26f0ba34
...
...
@@ -18,7 +18,7 @@ class ExpireJobCacheWorker # rubocop:disable Scalability/IdempotentWorker
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
job_id
)
job
=
CommitStatus
.
eager_load_pipeline
.
find_by
(
id:
job_id
)
job
=
CommitStatus
.
preload
(
:pipeline
,
:project
)
.
find_by
(
id:
job_id
)
return
unless
job
pipeline
=
job
.
pipeline
...
...
spec/support/database/cross-join-allowlist.yml
View file @
26f0ba34
...
...
@@ -385,7 +385,6 @@
-
"
./spec/views/projects/jobs/_build.html.haml_spec.rb"
-
"
./spec/workers/ci/drop_pipeline_worker_spec.rb"
-
"
./spec/workers/ci/initial_pipeline_process_worker_spec.rb"
-
"
./spec/workers/expire_job_cache_worker_spec.rb"
-
"
./spec/workers/new_merge_request_worker_spec.rb"
-
"
./spec/workers/pipeline_process_worker_spec.rb"
-
"
./spec/workers/pipeline_schedule_worker_spec.rb"
...
...
spec/workers/expire_job_cache_worker_spec.rb
View file @
26f0ba34
...
...
@@ -13,24 +13,6 @@ RSpec.describe ExpireJobCacheWorker do
let
(
:job_args
)
{
job
.
id
}
it
'does not perform extra queries'
,
:aggregate_failures
do
worker
=
described_class
.
new
recorder
=
ActiveRecord
::
QueryRecorder
.
new
{
worker
.
perform
(
job
.
id
)
}
occurences
=
recorder
.
data
.
values
.
flat_map
{
|
v
|
v
[
:occurrences
]}
project_queries
=
occurences
.
select
{
|
s
|
s
.
include?
(
'FROM "projects"'
)}
namespace_queries
=
occurences
.
select
{
|
s
|
s
.
include?
(
'FROM "namespaces"'
)}
route_queries
=
occurences
.
select
{
|
s
|
s
.
include?
(
'FROM "routes"'
)}
# This worker is run 1 million times an hour, so we need to save as much
# queries as possible.
expect
(
recorder
.
count
).
to
be
<=
1
expect
(
project_queries
.
size
).
to
eq
(
0
)
expect
(
namespace_queries
.
size
).
to
eq
(
0
)
expect
(
route_queries
.
size
).
to
eq
(
0
)
end
it_behaves_like
'worker with data consistency'
,
described_class
,
data_consistency: :delayed
...
...
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