Puma Rails 5 binding.pry only available for 60 seconds before timeout

旧时模样 提交于 2019-12-04 23:26:08

How about this?

# config/puma.rb    
...

environment ENV['RACK_ENV'] || 'development'

...

if ENV['RACK_ENV'] == 'development'
  worker_timeout 3600
end

Edit (Rails 5.1.5):

Because ENV['RACK_ENV'] was empty, I did the following:

# config/puma.rb 

...

if ENV.fetch('RAILS_ENV') == 'development'
   puts "LOGGER: development => worker_timeout 3600"
   worker_timeout 3600
end

You can create a configuration file and set the timeout value in there (for all requests, not just ones involved in debugging). I'd recommend making a dev-specific one, and referencing that when running the server locally (and not setting some big timeout value for production).

In your rails application, create a file like /config/dev_puma_config.rb and in it put:

#!/usr/bin/env puma

worker_timeout 3600

Then when you start your server, reference that file with a -C like this:

bundle exec puma -t 1:1 -w 1 -p 3000 -e development -C config/dev_puma_config.rb

As a bit of background info on that worker_timeout setting, here's what the puma config says about it:

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. Default value is 60 seconds.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!