Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/concerns/application_worker.rb')
-rw-r--r--app/workers/concerns/application_worker.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb
index 3cba1eb31c5..e158ae0c298 100644
--- a/app/workers/concerns/application_worker.rb
+++ b/app/workers/concerns/application_worker.rb
@@ -47,11 +47,36 @@ module ApplicationWorker
end
class_methods do
+ extend ::Gitlab::Utils::Override
+
def inherited(subclass)
subclass.set_queue
subclass.after_set_class_attribute { subclass.set_queue }
end
+ override :validate_worker_attributes!
+ def validate_worker_attributes!
+ super
+
+ # Since the delayed data_consistency will use sidekiq built in retry mechanism, it is required that this mechanism
+ # is not disabled.
+ if retry_disabled? && get_data_consistency == :delayed
+ raise ArgumentError, "Retry support cannot be disabled if data_consistency is set to :delayed"
+ end
+ end
+
+ # Checks if sidekiq retry support is disabled
+ def retry_disabled?
+ get_sidekiq_options['retry'] == 0 || get_sidekiq_options['retry'] == false
+ end
+
+ override :sidekiq_options
+ def sidekiq_options(opts = {})
+ super.tap do
+ validate_worker_attributes!
+ end
+ end
+
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