about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-29 02:07:14 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-29 02:07:14 +0100
commitcc70f28f195335f4775f7b6aafe7d90210e8b700 (patch)
treee933cbccbf6d3ec3b6627bba41f4b395c38d2f27
parentc0555f2db6b04edfbf829696648ec3998cef9365 (diff)
Adding rack timeout of 30sec, PuSH jobs moved to push queue so they
can be processed separately
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock4
-rw-r--r--app/workers/processing_worker.rb1
-rw-r--r--app/workers/pubsubhubbub/confirmation_worker.rb2
-rw-r--r--app/workers/pubsubhubbub/delivery_worker.rb2
-rw-r--r--app/workers/pubsubhubbub/distribution_worker.rb2
-rw-r--r--app/workers/salmon_worker.rb1
-rw-r--r--config/environments/production.rb2
-rw-r--r--config/initializers/timeout.rb1
-rw-r--r--docker-compose.yml2
10 files changed, 16 insertions, 2 deletions
diff --git a/Gemfile b/Gemfile
index 40f7a4002..809fd5a7d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -41,6 +41,7 @@ gem 'simple_form'
 gem 'will_paginate'
 gem 'rack-attack'
 gem 'rack-cors', require: 'rack/cors'
+gem 'rack-timeout-puma'
 gem 'sidekiq'
 gem 'ledermann-rails-settings'
 gem 'pg_search'
diff --git a/Gemfile.lock b/Gemfile.lock
index 4a72b6b93..0be10bbfb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -257,6 +257,9 @@ GEM
       rack
     rack-test (0.6.3)
       rack (>= 1.0)
+    rack-timeout (0.4.2)
+    rack-timeout-puma (0.0.1)
+      rack-timeout (~> 0.2, >= 0.2.0)
     rails-dom-testing (2.0.1)
       activesupport (>= 4.2.0, < 6.0)
       nokogiri (~> 1.6.0)
@@ -438,6 +441,7 @@ DEPENDENCIES
   rabl
   rack-attack
   rack-cors
+  rack-timeout-puma
   rails!
   rails_12factor
   rails_autolink
diff --git a/app/workers/processing_worker.rb b/app/workers/processing_worker.rb
index 34433a793..b31cd0aaf 100644
--- a/app/workers/processing_worker.rb
+++ b/app/workers/processing_worker.rb
@@ -2,6 +2,7 @@
 
 class ProcessingWorker
   include Sidekiq::Worker
+  
   sidekiq_options backtrace: true
 
   def perform(account_id, body)
diff --git a/app/workers/pubsubhubbub/confirmation_worker.rb b/app/workers/pubsubhubbub/confirmation_worker.rb
index b852970a9..489bd8359 100644
--- a/app/workers/pubsubhubbub/confirmation_worker.rb
+++ b/app/workers/pubsubhubbub/confirmation_worker.rb
@@ -4,6 +4,8 @@ class Pubsubhubbub::ConfirmationWorker
   include Sidekiq::Worker
   include RoutingHelper
 
+  sidekiq_options queue: 'push'
+
   def perform(subscription_id, mode, secret = nil, lease_seconds = nil)
     subscription = Subscription.find(subscription_id)
     challenge    = SecureRandom.hex
diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb
index 4d55798e8..6d526c2b1 100644
--- a/app/workers/pubsubhubbub/delivery_worker.rb
+++ b/app/workers/pubsubhubbub/delivery_worker.rb
@@ -4,6 +4,8 @@ class Pubsubhubbub::DeliveryWorker
   include Sidekiq::Worker
   include RoutingHelper
 
+  sidekiq_options queue: 'push'
+
   def perform(subscription_id, payload)
     subscription = Subscription.find(subscription_id)
     headers      = {}
diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb
index 7917434f7..b0ddc71c1 100644
--- a/app/workers/pubsubhubbub/distribution_worker.rb
+++ b/app/workers/pubsubhubbub/distribution_worker.rb
@@ -3,6 +3,8 @@
 class Pubsubhubbub::DistributionWorker
   include Sidekiq::Worker
 
+  sidekiq_options queue: 'push'
+
   def perform(stream_entry_id)
     stream_entry = StreamEntry.find(stream_entry_id)
     account      = stream_entry.account
diff --git a/app/workers/salmon_worker.rb b/app/workers/salmon_worker.rb
index 4a6ccf54d..0903ca487 100644
--- a/app/workers/salmon_worker.rb
+++ b/app/workers/salmon_worker.rb
@@ -2,6 +2,7 @@
 
 class SalmonWorker
   include Sidekiq::Worker
+  
   sidekiq_options backtrace: true
 
   def perform(account_id, body)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 0672cd587..9254d494c 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -30,7 +30,7 @@ Rails.application.configure do
 
   # Specifies the header that your server uses for sending files.
   # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
-  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+  config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
 
   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
   config.force_ssl = false
diff --git a/config/initializers/timeout.rb b/config/initializers/timeout.rb
new file mode 100644
index 000000000..8b7311e39
--- /dev/null
+++ b/config/initializers/timeout.rb
@@ -0,0 +1 @@
+Rack::Timeout.timeout = 30
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 3392dd242..e1f1f1c4c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -23,7 +23,7 @@ services:
     restart: always
     build: .
     env_file: .env.production
-    command: bundle exec sidekiq -q default -q mailers
+    command: bundle exec sidekiq -q default -q mailers -q push
     depends_on:
       - db
       - redis