Sha256: 1aa7021e6ccc7fc433f064fb4f82bdb0facd9f5f4bcc438dfc4552d9a3f1c49a

Contents?: true

Size: 350 Bytes

Versions: 5

Compression:

Stored size: 350 Bytes

Contents

require 'puma/plugin'

Puma::Plugin.create do
  def start(launcher)
    path = File.join("tmp", "restart.txt")

    File.write path, ""

    orig = File.stat(path).mtime

    in_background do
      while true
        sleep 2

        if File.stat(path).mtime > orig
          launcher.restart
          break
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puma-3.0.1-java lib/puma/plugin/tmp_restart.rb
puma-3.0.1 lib/puma/plugin/tmp_restart.rb
puma-3.0.0-java lib/puma/plugin/tmp_restart.rb
puma-3.0.0 lib/puma/plugin/tmp_restart.rb
puma-3.0.0.rc1 lib/puma/plugin/tmp_restart.rb