diff options
author | Jonne Haß <me@mrzyx.de> | 2013-02-19 12:34:41 +0400 |
---|---|---|
committer | Jonne Haß <me@mrzyx.de> | 2013-03-22 02:39:07 +0400 |
commit | 79a79d65d684b6cfa93e1d2dde9ac7abcfb7a481 (patch) | |
tree | 669d78aa2e901133bf58ec26c98c3e705f13bff3 /config/unicorn.rb | |
parent | 3fc3b249e71f05a664a81d47d35f9b2815de5e97 (diff) |
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
Diffstat (limited to 'config/unicorn.rb')
-rw-r--r-- | config/unicorn.rb | 17 |
1 files changed, 7 insertions, 10 deletions
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 |