Top Level Namespace

Defined Under Namespace

Modules: Puma

Instance Method Summary collapse

Instance Method Details

#monitor_loop(handler, delay, launcher, logger) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/puma/plugin/redeploy.rb', line 20

def monitor_loop(handler, delay, launcher, logger)
  loop do
    sleep delay

    next unless handler.needs_redeploy?

    watch_file_data = handler.watch_file_data
    archive_file = handler.archive_file(watch_file_data[:archive_location])

    logger.info "Puma phased_restart begin file=#{handler.watch_file} archive=#{archive_file}"

    handler.deploy(source: archive_file)

    Puma::Redeploy::CommandRunner.new(commands: watch_file_data[:commands], logger:).run

    restart_method = launcher.options[:restart_method] || :phased_restart
    launcher.send(restart_method)
  end
end