Rails Puma Net :: ReadTimeout请求自我开发模式

时间:2018-06-09 12:11:15

标签: ruby-on-rails puma

我正在使用puma开发一个rails应用程序并继续运行Net::ReadTimeout

基本上我的rails应用程序A从另一个服务器B请求某些内容,它通过API调用从A请求某些内容,直到它返回A并返回结果。

有时它会起作用,有时会导致超时,因为B没有得到回应。

这似乎是一个线程锁定,虽然我不明白为什么。

在锁定期间,我仍然可以通过命令行向A发出请求并获得响应......

puma.rb

workers Integer(ENV['WEB_CONCURRENCY'] || 8)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'


on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-        applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

Procfile

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -t 25 -c3

我怎么办才能不锁定/为什么从控制台到A的请求会起作用?

0 个答案:

没有答案