diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-06-04 14:44:02 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-06-05 09:08:10 +1000 |
commit | 977ba4cc150092107944f3a46734b2540d321dcf (patch) | |
tree | 23b8f60ad5efed565fb5390be95346e88d952323 /app/workers | |
parent | 75e11922026db90ccb81b0125b18b0bd2ffbb7fb (diff) | |
download | gitlab-ce-977ba4cc150092107944f3a46734b2540d321dcf.tar.gz |
Ensure DB is writable before continuing jobs11925-geo-sidekiq-nodes-try-to-run-jobs-even-thought-db-is-readonly
In the context of a Geo setup, some jobs can be
running on a Geo secondary where the database
is read-only and therefore we should guard
against various jobs attempting to write.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/pages_domain_verification_cron_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/pages_domain_verification_worker.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/app/workers/pages_domain_verification_cron_worker.rb b/app/workers/pages_domain_verification_cron_worker.rb index 92d62a15aee..60703c83e9e 100644 --- a/app/workers/pages_domain_verification_cron_worker.rb +++ b/app/workers/pages_domain_verification_cron_worker.rb @@ -5,6 +5,8 @@ class PagesDomainVerificationCronWorker include CronjobQueue def perform + return if Gitlab::Database.read_only? + PagesDomain.needs_verification.find_each do |domain| PagesDomainVerificationWorker.perform_async(domain.id) end diff --git a/app/workers/pages_domain_verification_worker.rb b/app/workers/pages_domain_verification_worker.rb index b3319ff5a13..7817b2ee5fc 100644 --- a/app/workers/pages_domain_verification_worker.rb +++ b/app/workers/pages_domain_verification_worker.rb @@ -5,6 +5,8 @@ class PagesDomainVerificationWorker # rubocop: disable CodeReuse/ActiveRecord def perform(domain_id) + return if Gitlab::Database.read_only? + domain = PagesDomain.find_by(id: domain_id) return unless domain |