Skip to content

Commit

Permalink
Merge pull request hotsh#828 from carols10cents/add-rack-timeout
Browse files Browse the repository at this point in the history
Add rack-timeout gem as recommended by heroku for puma
  • Loading branch information
wilkie committed Jan 16, 2015
2 parents b5ac7cf + 0dd2ab5 commit ebb0274
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ gem "exceptional", "~> 2.0.32"
gem "newrelic_rpm", "~> 3.9.6"
gem "draper", "~> 0.11.1"
gem "open_uri_redirections", "~> 0.1.4"
gem "rack-timeout", "~> 0.1.0"

# background job queue
gem "delayed_job", :git => "git://github.com/collectiveidea/delayed_job.git", :tag => "v2.1.4"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rack-timeout (0.1.0)
rails (3.2.20)
actionmailer (= 3.2.20)
actionpack (= 3.2.20)
Expand Down Expand Up @@ -323,6 +324,7 @@ DEPENDENCIES
puma (~> 2.9.0)
pygmentize (~> 0.0.3)
quiet_assets (~> 1.0.0)
rack-timeout (~> 0.1.0)
rails (= 3.2.20)
ratom (~> 0.8.2)
rdiscount (~> 1.6.8)
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/timeout.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Heroku will time out requests at 30 seconds and show an error to the user, but puma won't know
# that heroku has terminated the request early, so puma will keep working. This will tell puma to
# stop and will log a timeout exception.
Rack::Timeout.timeout = 25 # seconds

0 comments on commit ebb0274

Please sign in to comment.