Commit 47d44b3c authored by Stan Hu's avatar Stan Hu

Merge branch '3334-check-when-geo-nodes-exists-geo' into 'master'

check if the GeoNode table exists before checking its state

Closes #3334

See merge request gitlab-org/gitlab-ee!3298
parents ca024172 bc0574cd
...@@ -115,9 +115,9 @@ module Gitlab ...@@ -115,9 +115,9 @@ module Gitlab
end end
def self.configure_cron_jobs! def self.configure_cron_jobs!
if self.primary? if self.connected? && self.primary?
self.configure_primary_jobs! self.configure_primary_jobs!
elsif self.secondary? elsif self.connected? && self.secondary?
self.configure_secondary_jobs! self.configure_secondary_jobs!
else else
self.enable_all_cron_jobs! self.enable_all_cron_jobs!
......
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
class << self class << self
def configure_cron_job! def configure_cron_job!
destroy_cron_job! destroy_cron_job!
return if Gitlab::Geo.secondary? return if Gitlab::Geo.connected? && Gitlab::Geo.secondary?
Sidekiq::Cron::Job.create( Sidekiq::Cron::Job.create(
name: 'update_all_mirrors_worker', name: 'update_all_mirrors_worker',
......
...@@ -37,6 +37,7 @@ describe Gitlab::Mirror do ...@@ -37,6 +37,7 @@ describe Gitlab::Mirror do
expect(Sidekiq::Cron::Job.find("update_all_mirrors_worker")).to be_enabled expect(Sidekiq::Cron::Job.find("update_all_mirrors_worker")).to be_enabled
allow(Gitlab::Geo).to receive(:connected?).and_return(true)
allow(Gitlab::Geo).to receive(:secondary?).and_return(true) allow(Gitlab::Geo).to receive(:secondary?).and_return(true)
described_class.configure_cron_job! described_class.configure_cron_job!
......
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