Skip to content

Commit

Permalink
fix deadlines for standby deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Jun 5, 2024
1 parent 21ad881 commit 1c75682
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion prog/lantern/lantern_resource_nexus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ def before_run

if lantern_resource.parent_id.nil?
lantern_resource.allow_timeline_access_to_bucket
register_deadline(:wait, 10 * 60)
else
register_deadline(:wait, 120 * 60)
end

register_deadline(:wait, 10 * 60)
hop_wait_servers
end

Expand Down
16 changes: 11 additions & 5 deletions prog/lantern/lantern_server_nexus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def before_run
end

label def update_rhizome
register_deadline(:wait, 10 * 60)

decr_update_rhizome
bud Prog::UpdateRhizome, {"target_folder" => "lantern", "subject_id" => vm.id, "user" => "lantern"}
hop_wait_update_rhizome
Expand All @@ -103,7 +101,7 @@ def before_run
end

label def bootstrap_rhizome
register_deadline(:wait, 10 * 60)
register_deadline(:setup_docker_stack, 10 * 60)

bud Prog::BootstrapRhizome, {"target_folder" => "lantern", "subject_id" => vm.id, "user" => "lantern"}
hop_wait_bootstrap_rhizome
Expand All @@ -112,7 +110,7 @@ def before_run
label def wait_bootstrap_rhizome
reap
if leaf?
register_deadline(:wait, 10 * 60)
register_deadline(:wait_db_available, 10 * 60)
hop_setup_docker_stack
end
donate
Expand All @@ -132,6 +130,15 @@ def before_run
if !lantern_server.domain.nil?
lantern_server.incr_add_domain
end

# set higher deadline for secondary as it needs time
# to download backcup and replay wal
if lantern_server.primary?
register_deadline(:wait, 40 * 60)
else
register_deadline(:wait, 120 * 60)
end

hop_wait_db_available
when "Failed", "NotStarted"
vm.sshable.cmd("common/bin/daemonizer 'sudo lantern/bin/configure' configure_lantern", stdin: lantern_server.configure_hash)
Expand Down Expand Up @@ -226,7 +233,6 @@ def before_run
decr_initial_provisioning

if lantern_server.primary?
register_deadline(:wait, 40 * 60)
hop_init_sql
end
hop_wait_catch_up if lantern_server.standby?
Expand Down
4 changes: 4 additions & 0 deletions spec/prog/lantern/lantern_server_nexus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@
expect(lantern_server.vm.sshable).to receive(:cmd).with("common/bin/daemonizer --clean configure_lantern")
expect(lantern_server).to receive(:domain).and_return("db.lantern.dev")
expect(lantern_server).to receive(:incr_add_domain)
expect(lantern_server).to receive(:primary?).and_return(true)
expect(nx).to receive(:register_deadline).with(:wait, 40 * 60)
expect { nx.setup_docker_stack }.to hop("wait_db_available")
end

Expand All @@ -244,6 +246,8 @@
expect(lantern_server.vm.sshable).to receive(:cmd).with("common/bin/daemonizer --check configure_lantern").and_return("Succeeded")
expect(lantern_server.vm.sshable).to receive(:cmd).with("common/bin/daemonizer --clean configure_lantern")
expect(lantern_server).to receive(:domain).and_return(nil)
expect(lantern_server).to receive(:primary?).and_return(false)
expect(nx).to receive(:register_deadline).with(:wait, 120 * 60)
expect { nx.setup_docker_stack }.to hop("wait_db_available")
end

Expand Down

0 comments on commit 1c75682

Please sign in to comment.