本文介绍了Puma Rails 5 binding.pry 仅在超时前 60 秒可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 binding.pry 时,Puma 超时了我的请求.在我的控制器中

Puma times out my request when I'm using binding.pry. In my controller

def new
  require 'pry'
  binding.pry
end

然后我发出一个请求,该请求命中控制器并进入 pry 会话.60秒后彪马?超时我的请求,重新启动一个工作程序,随后被调试会话炸毁.

I then make a request that hits the controller and enter the pry session. After 60 seconds Puma? times out my request, restarts a worker and subsequently blows up by debugging session.

[1] pry(#<Agent::ClientsController>)> [3522] ! Terminating timed out worker: 3566
[3522] - Worker 0 (pid: 4171) booted, phase: 0

如果重要的话,我用吊带裤生成了这个应用程序.如何在 rails 5 中扩展我的调试会话?

I generated this app with suspenders if that matters. How do I extend my debugging session in rails 5?

推荐答案

这个怎么样?

# config/puma.rb    
...

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

...

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

编辑(Rails 5.1.5):

因为 ENV['RACK_ENV'] 是空的,我做了以下事情:

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

这篇关于Puma Rails 5 binding.pry 仅在超时前 60 秒可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:08