No commit activity in last 3 years
No release in over 3 years
Graceful handling of requests which are reaching the timeout limit to avoid SIGKILL
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

unicorn-soft-timeout

This gem adds support for soft timeout in Unicorn configurations, by default requests which are taking longer than configured timeout are SIGKILL-ed.

In some cases we need to intercept requests which will reach timeout to display a custom content instead of the error page. This extension will raise Timeout::Error when reaching the soft timeout and will restart the worker sending a SIGQUIT signal to it.

  • Build Status

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.
use Unicorn::SoftTimeout, 10

Credits

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request