Sha256: 807eec2d3e413dee3e3b54e11509a5aa962da7ff8b6258a7ed98c1243c512561
Contents?: true
Size: 679 Bytes
Versions: 30
Compression:
Stored size: 679 Bytes
Contents
require 'puma/plugin' Puma::Plugin.create do def start(launcher) path = File.join("tmp", "restart.txt") orig = nil # If we can't write to the path, then just don't bother with this plugin begin File.write path, "" orig = File.stat(path).mtime rescue SystemCallError return end in_background do while true sleep 2 begin mtime = File.stat(path).mtime rescue SystemCallError # If the file has disappeared, assume that means don't restart else if mtime > orig launcher.restart break end end end end end end
Version data entries
30 entries across 30 versions & 2 rubygems