lib/griffin/server.rb in griffin-0.2.2 vs lib/griffin/server.rb in griffin-0.2.3
- old
+ new
@@ -10,10 +10,11 @@
class Server
DEFAULT_BACKLOG_SIZE = 1024
GRACEFUL_SHUTDOWN = '0'
FORCIBLE_SHUTDOWN = '1'
+ GRACEFUL_RESTART = '2'
class << self
# @param bind [String]
# @param port [Integer,String]
def run(bind: nil, port: nil)
@@ -128,9 +129,16 @@
when GRACEFUL_SHUTDOWN
Griffin.logger.info("Shutting down sever(id=#{@worker_id}) gracefully...")
@status = :stop
@server.graceful_shutdown
+ true
+ when GRACEFUL_RESTART
+ Griffin.logger.info("Restart sever(id=#{@worker_id}) gracefully...")
+
+ @status = :restart
+ # timeout is false since we don't know when all connections are closed by clients.
+ @server.graceful_shutdown(timeout: false)
true
end
end
end
end