mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
24 lines
350 B
Ruby
24 lines
350 B
Ruby
![]() |
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
|
||
|
|