Unicorn::SoftTimeout
This gem adds support for soft timeout in Unicorn. By default requests which are taking longer than configured timeout are SIGKILL-ed. In some cases we need to intercept those requests to display a custom content instead of the error page.
Installation
Add this line to your application's Gemfile:
gem 'unicorn-soft-timeout'
And then execute:
$ bundle
Or install it yourself as:
$ gem install unicorn-soft-timeout
Usage
Edit your config.ru file and load the Unicorn::SoftTimeout middleware:
# config.ru
require 'unicorn/soft_timeout'
# Specify your soft timeout (default 12 seconds), it should
# be a lower value than **timeout** specified in your unicorn config.
# This extension will raise Timeout::Error when reaching
# the **soft timeout**.
use Unicorn::SoftTimeout, 10
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request