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
1282e2e5
Commit
1282e2e5
authored
May 06, 2021
by
Nikola Milojevic
Committed by
Kamil Trzciński
May 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delayed scheduling of BuildHooksWorker [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
dc735579
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
app/workers/build_hooks_worker.rb
app/workers/build_hooks_worker.rb
+10
-0
config/feature_flags/development/delayed_perform_for_build_hooks_worker.yml
...gs/development/delayed_perform_for_build_hooks_worker.yml
+8
-0
spec/workers/build_hooks_worker_spec.rb
spec/workers/build_hooks_worker_spec.rb
+18
-0
No files found.
app/workers/build_hooks_worker.rb
View file @
1282e2e5
...
...
@@ -11,6 +11,16 @@ class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
urgency
:high
data_consistency
:delayed
,
feature_flag: :load_balancing_for_build_hooks_worker
DATA_CONSISTENCY_DELAY
=
3
def
self
.
perform_async
(
*
args
)
if
Feature
.
enabled?
(
:delayed_perform_for_build_hooks_worker
,
default_enabled: :yaml
)
perform_in
(
DATA_CONSISTENCY_DELAY
.
seconds
,
*
args
)
else
super
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
build_id
)
Ci
::
Build
.
includes
({
runner: :tags
})
...
...
config/feature_flags/development/delayed_perform_for_build_hooks_worker.yml
0 → 100644
View file @
1282e2e5
---
name
:
delayed_perform_for_build_hooks_worker
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61149
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/330132
milestone
:
'
13.12'
type
:
development
group
:
group::memory
default_enabled
:
false
spec/workers/build_hooks_worker_spec.rb
View file @
1282e2e5
...
...
@@ -23,6 +23,24 @@ RSpec.describe BuildHooksWorker do
end
end
describe
'.perform_async'
do
context
'when delayed_perform_for_build_hooks_worker feature flag is disabled'
do
before
do
stub_feature_flags
(
delayed_perform_for_build_hooks_worker:
false
)
end
it
'does not call perform_in'
do
expect
(
described_class
).
not_to
receive
(
:perform_in
)
end
end
it
'delays scheduling a job by calling perform_in'
do
expect
(
described_class
).
to
receive
(
:perform_in
).
with
(
described_class
::
DATA_CONSISTENCY_DELAY
.
second
,
123
)
described_class
.
perform_async
(
123
)
end
end
it_behaves_like
'worker with data consistency'
,
described_class
,
feature_flag: :load_balancing_for_build_hooks_worker
,
...
...
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