Method: Puma::DSL#worker_timeout

Defined in:
lib/puma/dsl.rb

#worker_timeout(timeout) ⇒ Object

Note:

Cluster mode only.

Verifies that all workers have checked in to the master process within the given timeout. If not the worker process will be restarted. This is not a request timeout, it is to protect against a hung or dead process. Setting this value will not protect against slow requests.

This value must be greater than worker_check_interval.

The default is 60 seconds.

Examples:

worker_timeout 60

See Also:

  • Cluster::Worker#ping_timeout


1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
# File 'lib/puma/dsl.rb', line 1125

def worker_timeout(timeout)
  timeout = Integer(timeout)
  min = @options.fetch(:worker_check_interval, Configuration::DEFAULTS[:worker_check_interval])

  if timeout <= min
    raise "The minimum worker_timeout must be greater than the worker reporting interval (#{min})"
  end

  @options[:worker_timeout] = timeout
end