Module: HerokuSan::Application

Included in:
Stage
Defined in:
lib/heroku_san/application.rb

Instance Method Summary collapse

Instance Method Details

#ensure_all_workers_runningObject



11
12
13
14
15
16
17
18
19
# File 'lib/heroku_san/application.rb', line 11

def ensure_all_workers_running
  while true do
    processes = heroku.get_ps(app).body

    return if processes.all? { |p| p["state"] == "up" }

    restart_processes(processes)
  end
end

#ensure_one_worker_running(at_least = 1) ⇒ Object



5
6
7
8
9
# File 'lib/heroku_san/application.rb', line 5

def ensure_one_worker_running(at_least = 1)
  begin
    web_processes = heroku.get_ps(app).body.select { |p| p["process"] =~ /web\./ }
  end until restart_processes(web_processes) >= at_least
end