Commit 1c82d36c authored by nmilojevic1's avatar nmilojevic1

Delay worker execution for workers utilizing LB

Changelog: added
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62374
parent cc5c3f4f
......@@ -55,7 +55,7 @@ module ApplicationWorker
def perform_async(*args)
# Worker execution for workers with data_consistency set to :delayed or :sticky
# will be delayed to give replication enough time to complete
if utilizes_load_balancing_capabilities? && data_consistency_delayed_execution_feature_flag_enabled?
if utilizes_load_balancing_capabilities?
perform_in(delay_interval, *args)
else
super
......@@ -125,10 +125,6 @@ module ApplicationWorker
protected
def data_consistency_delayed_execution_feature_flag_enabled?
Feature.enabled?(:data_consistency_delayed_execution, default_enabled: :yaml)
end
def delay_interval
DEFAULT_DELAY_INTERVAL.seconds
end
......
---
name: data_consistency_delayed_execution
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61501
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331110
milestone: '14.0'
type: development
group: group::memory
default_enabled: false
......@@ -182,24 +182,6 @@ RSpec.describe ApplicationWorker do
worker.data_consistency(data_consistency)
end
context 'when data_consistency_delayed_execution feature flag is disabled' do
before do
stub_feature_flags(data_consistency_delayed_execution: false)
end
it 'data_consistency_delayed_execution_feature_flag_enabled? should return false' do
expect(worker).to receive(:data_consistency_delayed_execution_feature_flag_enabled?).and_return(false)
worker.perform_async
end
it 'does not call perform_in' do
expect(worker).not_to receive(:perform_in)
worker.perform_async
end
end
it 'call perform_in' do
expect(worker).to receive(:perform_in).with(described_class::DEFAULT_DELAY_INTERVAL.seconds, 123)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment