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/worker_attributes.rb')
-rw-r--r--app/workers/concerns/worker_attributes.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/workers/concerns/worker_attributes.rb b/app/workers/concerns/worker_attributes.rb
index 1674ed1483a..c260e06607c 100644
--- a/app/workers/concerns/worker_attributes.rb
+++ b/app/workers/concerns/worker_attributes.rb
@@ -33,6 +33,8 @@ module WorkerAttributes
security_scans: 2
}.stringify_keys.freeze
+ DEFAULT_DEFER_DELAY = 5.seconds
+
class_methods do
def feature_category(value, *extras)
set_class_attribute(:feature_category, value)
@@ -190,5 +192,20 @@ module WorkerAttributes
def big_payload?
!!get_class_attribute(:big_payload)
end
+
+ def defer_on_database_health_signal(gitlab_schema, delay_by = DEFAULT_DEFER_DELAY, tables = [])
+ set_class_attribute(
+ :database_health_check_attrs,
+ { gitlab_schema: gitlab_schema, delay_by: delay_by, tables: tables }
+ )
+ end
+
+ def defer_on_database_health_signal?
+ database_health_check_attrs.present?
+ end
+
+ def database_health_check_attrs
+ get_class_attribute(:database_health_check_attrs)
+ end
end
end