ruby-on-railsunicorn

Unicorn different timeout for different controller actions


I have simple question but cannot find the answer. Can I set different timeout for different controller action?

The reason is that I am serving one huge json for d3.js chart and unicorn is killing worker after 30 seconds.

I can fix the problem by changing timeout to 60 seconds for example but I dont think it is good solution to have so big timeout set for any other jobs/actions which should really finish within 30 seconds. Is there any way how to specify timeout only for one action?


Solution

  • It is a hard limit, there isn't a way to use it for a specific action. It is configuring the master process, which will send SIGKILL to the workers.

    https://yhbt.net/unicorn/Unicorn/Configurator.html#method-i-timeout https://devcenter.heroku.com/articles/request-timeout#timeout-behavior

    Maybe you can use https://github.com/ankane/slowpoke (I haven't tried it)