Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add interruption support to Rack Handler

  • Loading branch information...
commit a022c4197205595cdb63599001f147fb2b7b4164 1 parent a2da39c
@stereobooster authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/rack/handler/puma.rb
View
9 lib/rack/handler/puma.rb
@@ -30,7 +30,14 @@ def self.run(app, options = {})
server.max_threads = Integer(max)
yield server if block_given?
- server.run.join
+ begin
+ server.run.join
+ rescue Interrupt
+ puts "* Gracefully stopping, waiting for requests to finish"
+ server.stop(true)
+ puts "* Goodbye!"
+ end
+
end
def self.valid_options
Please sign in to comment.
Something went wrong with that request. Please try again.