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:
commit
ce4b9d5d0e
3 changed files with 10 additions and 2 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
#
|
#
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue