Sha256: 22f8f956895ece7533247426894c47e8b055eaa5ff76a8ac5932f7b944281027
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 KB
Contents
## # This file... # # 1. Requires {ProxyMachine} (because requiring it boots it up, causing ruckus # when you don't want to run it, like during specs). # # 2. Monkey-patch {ProxyMachine#fast_shutdown} so I can change the sleep # time... 10 seconds is forever to wait when developing, and I don't see # a way to configure it without patching. # ## require 'proxymachine' class ProxyMachine @@max_fast_shutdown_seconds = 1 def self.fast_shutdown(signal) EM.stop_server($server) if $server # Can't log in trap context (guess you used to be able to?) and this method # is only entered from trap contexts, so comment these out to avoid the # warning... # # LOGGER.info "Received #{signal} signal. No longer accepting new connections." # LOGGER.info "Maximum time to wait for connections is #{@@max_fast_shutdown_seconds} seconds." # LOGGER.info "Waiting for #{ProxyMachine.count} connections to finish." $server = nil EM.stop if ProxyMachine.count == 0 Thread.new do sleep @@max_fast_shutdown_seconds exit! end end end
Version data entries
11 entries across 11 versions & 1 rubygems