From 79a79d65d684b6cfa93e1d2dde9ac7abcfb7a481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Tue, 19 Feb 2013 09:34:41 +0100 Subject: Bye Resque. Ohai Sidekiq. * Dropped all references to Resque * Moved all jobs under app/workers since that's the Sidekiq convention * Renamed Jobs module to Worker to match new location * Adapted all jobs to Sidekiq * Replaced all enqueue calls with perform_async * Dropped Resque hacks from specs and features, replaced with sidekig/testing in RSpec and sidekig/testing/inline in Cucumber * Updated scripts to start a Sidekiq server * Inline Sidekiq sinatra app * Let Sidekiq create the actual Redis instance * Workaround already initialized constant warnings in service models * Resolved ToDo in one job definition by creating proper exception clases for some errors in receiving posts * Added sidekiq section to configuration to make it completly configurable to the user * Add Sidekiq middleware for clean backtraces * Delay HttpMulti retry to give offline pods a chance to come back up * Do not retry on GUID already taken and alike errors * Be graceful about deleted posts in GatherOEmbedData --- config/unicorn.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'config/unicorn.rb') diff --git a/config/unicorn.rb b/config/unicorn.rb index b63d252e9..281469169 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -15,7 +15,7 @@ preload_app true # How long to wait before killing an unresponsive worker timeout 30 -@resque_pid = nil +@sidekiq_pid = nil #pid '/var/run/diaspora/diaspora.pid' #listen '/var/run/diaspora/diaspora.sock', :backlog => 2048 @@ -33,14 +33,12 @@ before_fork do |server, worker| ActiveRecord::Base.connection.disconnect! # disconnect redis if in use - if !AppConfig.single_process_mode? - Resque.redis.client.disconnect + unless AppConfig.single_process_mode? + Sidekiq.redis {|redis| redis.client.disconnect } end - if AppConfig.server.embed_resque_worker? - # Clean up Resque workers killed by previous deploys/restarts - Resque.workers.each { |w| w.unregister_worker } - @resque_pid ||= spawn('bundle exec rake resque:work QUEUES=*') + if AppConfig.server.embed_sidekiq_worker? + @sidekiq_pid ||= spawn('bundle exec sidekiq') end old_pid = '/var/run/diaspora/diaspora.pid.oldbin' @@ -58,9 +56,8 @@ after_fork do |server, worker| # If using preload_app, enable this line ActiveRecord::Base.establish_connection - # copy pasta from resque.rb because i'm a bad person - if !AppConfig.environment.single_process_mode? - Resque.redis = AppConfig.get_redis_instance + unless AppConfig.environment.single_process_mode? + Sidekiq.redis = AppConfig.get_redis_options end # Enable this line to have the workers run as different user/group -- cgit v1.2.3