Adding rack timeout of 30sec, PuSH jobs moved to push queue so they

can be processed separately
This commit is contained in:
Eugen Rochko 2016-11-29 02:07:14 +01:00
parent c0555f2db6
commit cc70f28f19
10 changed files with 16 additions and 2 deletions

View File

@ -41,6 +41,7 @@ gem 'simple_form'
gem 'will_paginate' gem 'will_paginate'
gem 'rack-attack' gem 'rack-attack'
gem 'rack-cors', require: 'rack/cors' gem 'rack-cors', require: 'rack/cors'
gem 'rack-timeout-puma'
gem 'sidekiq' gem 'sidekiq'
gem 'ledermann-rails-settings' gem 'ledermann-rails-settings'
gem 'pg_search' gem 'pg_search'

View File

@ -257,6 +257,9 @@ GEM
rack rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) 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) rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0) activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
@ -438,6 +441,7 @@ DEPENDENCIES
rabl rabl
rack-attack rack-attack
rack-cors rack-cors
rack-timeout-puma
rails! rails!
rails_12factor rails_12factor
rails_autolink rails_autolink

View File

@ -2,6 +2,7 @@
class ProcessingWorker class ProcessingWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options backtrace: true sidekiq_options backtrace: true
def perform(account_id, body) def perform(account_id, body)

View File

@ -4,6 +4,8 @@ class Pubsubhubbub::ConfirmationWorker
include Sidekiq::Worker include Sidekiq::Worker
include RoutingHelper include RoutingHelper
sidekiq_options queue: 'push'
def perform(subscription_id, mode, secret = nil, lease_seconds = nil) def perform(subscription_id, mode, secret = nil, lease_seconds = nil)
subscription = Subscription.find(subscription_id) subscription = Subscription.find(subscription_id)
challenge = SecureRandom.hex challenge = SecureRandom.hex

View File

@ -4,6 +4,8 @@ class Pubsubhubbub::DeliveryWorker
include Sidekiq::Worker include Sidekiq::Worker
include RoutingHelper include RoutingHelper
sidekiq_options queue: 'push'
def perform(subscription_id, payload) def perform(subscription_id, payload)
subscription = Subscription.find(subscription_id) subscription = Subscription.find(subscription_id)
headers = {} headers = {}

View File

@ -3,6 +3,8 @@
class Pubsubhubbub::DistributionWorker class Pubsubhubbub::DistributionWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options queue: 'push'
def perform(stream_entry_id) def perform(stream_entry_id)
stream_entry = StreamEntry.find(stream_entry_id) stream_entry = StreamEntry.find(stream_entry_id)
account = stream_entry.account account = stream_entry.account

View File

@ -2,6 +2,7 @@
class SalmonWorker class SalmonWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options backtrace: true sidekiq_options backtrace: true
def perform(account_id, body) def perform(account_id, body)

View File

@ -30,7 +30,7 @@ Rails.application.configure do
# Specifies the header that your server uses for sending files. # 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-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. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false config.force_ssl = false

View File

@ -0,0 +1 @@
Rack::Timeout.timeout = 30

View File

@ -23,7 +23,7 @@ services:
restart: always restart: always
build: . build: .
env_file: .env.production env_file: .env.production
command: bundle exec sidekiq -q default -q mailers command: bundle exec sidekiq -q default -q mailers -q push
depends_on: depends_on:
- db - db
- redis - redis