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
d9928ec8
Commit
d9928ec8
authored
Aug 23, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates ExpireJobCacheWorker to use replica as long as possible
parent
d9a88070
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
25 deletions
+21
-25
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/expire_job_cache_worker.rb
app/workers/expire_job_cache_worker.rb
+7
-3
config/feature_flags/development/load_balancing_for_expire_job_cache_worker.yml
...evelopment/load_balancing_for_expire_job_cache_worker.yml
+8
-0
spec/workers/expire_job_cache_worker_spec.rb
spec/workers/expire_job_cache_worker_spec.rb
+5
-21
No files found.
app/workers/all_queues.yml
View file @
d9928ec8
...
...
@@ -1459,7 +1459,7 @@
:urgency: :high
:resource_boundary: :unknown
:weight:
3
:idempotent:
true
:idempotent:
:tags: []
-
:name: pipeline_cache:expire_pipeline_cache
:worker_name: ExpirePipelineCacheWorker
...
...
app/workers/expire_job_cache_worker.rb
View file @
d9928ec8
# frozen_string_literal: true
class
ExpireJobCacheWorker
class
ExpireJobCacheWorker
# rubocop:disable Scalability/IdempotentWorker
include
ApplicationWorker
data_consistency
:
always
data_consistency
:
delayed
,
feature_flag: :load_balancing_for_expire_job_cache_worker
sidekiq_options
retry:
3
include
PipelineQueue
queue_namespace
:pipeline_cache
urgency
:high
idempotent!
# This worker should be idempotent, but we're switching to data_consistency
# :sticky and there is an ongoing incompatibility, so it needs to be disabled for
# now. The following line can be uncommented and this comment removed once
# https://gitlab.com/gitlab-org/gitlab/-/issues/325291 is resolved.
# idempotent!
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
job_id
)
...
...
config/feature_flags/development/load_balancing_for_expire_job_cache_worker.yml
0 → 100644
View file @
d9928ec8
---
name
:
load_balancing_for_expire_job_cache_worker
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68791
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/339137
milestone
:
'
14.3'
type
:
development
group
:
group::pipeline authoring
default_enabled
:
false
spec/workers/expire_job_cache_worker_spec.rb
View file @
d9928ec8
...
...
@@ -13,27 +13,6 @@ RSpec.describe ExpireJobCacheWorker do
let
(
:job_args
)
{
job
.
id
}
include_examples
'an idempotent worker'
do
it
'invalidates Etag caching for the job path'
do
job_path
=
"/
#{
project
.
full_path
}
/builds/
#{
job
.
id
}
.json"
spy_store
=
Gitlab
::
EtagCaching
::
Store
.
new
allow
(
Gitlab
::
EtagCaching
::
Store
).
to
receive
(
:new
)
{
spy_store
}
expect
(
spy_store
).
to
receive
(
:touch
)
.
exactly
(
worker_exec_times
).
times
.
with
(
job_path
)
.
and_call_original
expect
(
ExpirePipelineCacheWorker
).
to
receive
(
:perform_async
)
.
with
(
pipeline
.
id
)
.
exactly
(
worker_exec_times
).
times
subject
end
end
it
'does not perform extra queries'
,
:aggregate_failures
do
worker
=
described_class
.
new
recorder
=
ActiveRecord
::
QueryRecorder
.
new
{
worker
.
perform
(
job
.
id
)
}
...
...
@@ -51,6 +30,11 @@ RSpec.describe ExpireJobCacheWorker do
expect
(
namespace_queries
.
size
).
to
eq
(
0
)
expect
(
route_queries
.
size
).
to
eq
(
0
)
end
it_behaves_like
'worker with data consistency'
,
described_class
,
feature_flag: :load_balancing_for_expire_job_cache_worker
,
data_consistency: :delayed
end
context
'when there is no job in the pipeline'
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