Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set rails request timeout longer?

My app is built on rails and the web server is puma.

I need to load data from database and it takes more than 60 seconds to load all of them. Every time I send a get request to the server, I have to wait more than 60 seconds.

The timeout of request get is 60 seconds, so I always get 504 gateway timeout. I can't find the place to change the request timeout in puma configuration. How can I set the request timeout longer than 60 seconds?

Thanks!

like image 322
Gravity Avatar asked Mar 14 '26 20:03

Gravity


1 Answers

UPDATE: Apparently worker_timeout is NOT the answer, as it relates to the whole process hanging, not just an individual request. So it seems to be something Puma doesn't support, and the developers are expecting you to implement it with whatever is fronting Puma, such as Nginx.

ORIGINAL: Rails itself doesn't time out, but use worker_timeout in config/puma.rb if you're running Puma. Example:

worker_timeout (246060) if ENV['RAILS_ENV']=='development'

Source

like image 71
mahemoff Avatar answered Mar 17 '26 09:03

mahemoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!