1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Merge pull request #1017 from jorihardman/configurable_persistent_timeout

Allow persistent_timeout to be configured via the dsl.
This commit is contained in:
Evan Phoenix 2016-07-18 21:22:17 -07:00 committed by GitHub
commit ce4b9d5d0e
3 changed files with 10 additions and 2 deletions

View file

@ -181,7 +181,8 @@ module Puma
:tag => method(:infer_tag), :tag => method(:infer_tag),
:environment => lambda { ENV['RACK_ENV'] || "development" }, :environment => lambda { ENV['RACK_ENV'] || "development" },
:rackup => DefaultRackup, :rackup => DefaultRackup,
:logger => STDOUT :logger => STDOUT,
:persistent_timeout => Const::PERSISTENT_TIMEOUT
} }
end end

View file

@ -133,6 +133,13 @@ module Puma
bind "tcp://#{host}:#{port}" bind "tcp://#{host}:#{port}"
end end
# Define how long persistent connections can be idle before puma closes
# them
#
def persistent_timeout(seconds)
@options[:persistent_timeout] = seconds
end
# Work around leaky apps that leave garbage in Thread locals # Work around leaky apps that leave garbage in Thread locals
# across requests # across requests
# #

View file

@ -63,7 +63,7 @@ module Puma
@thread = nil @thread = nil
@thread_pool = nil @thread_pool = nil
@persistent_timeout = PERSISTENT_TIMEOUT @persistent_timeout = options[:persistent_timeout]
@binder = Binder.new(events) @binder = Binder.new(events)
@own_binder = true @own_binder = true