UPGRADE: sidekiq to sidekiq 3.0

This commit is contained in:
Sam 2014-04-23 11:01:17 +10:00
parent 8abf652dc3
commit c6f9cc0787
3 changed files with 12 additions and 8 deletions

View File

@ -318,9 +318,9 @@ GEM
shoulda-context (1.1.6) shoulda-context (1.1.6)
shoulda-matchers (2.5.0) shoulda-matchers (2.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
sidekiq (2.17.6) sidekiq (3.0.0)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
connection_pool (>= 1.0.0) connection_pool (>= 2.0.0)
json json
redis (>= 3.0.6) redis (>= 3.0.6)
redis-namespace (>= 1.3.1) redis-namespace (>= 1.3.1)

View File

@ -1,13 +1,11 @@
require "sidekiq/pausable" require "sidekiq/pausable"
sidekiq_redis = { url: $redis.url, namespace: 'sidekiq' }
Sidekiq.configure_client do |config| Sidekiq.configure_client do |config|
config.redis = sidekiq_redis config.redis = Discourse.sidekiq_redis_config
end end
Sidekiq.configure_server do |config| Sidekiq.configure_server do |config|
config.redis = sidekiq_redis config.redis = Discourse.sidekiq_redis_config
# add our pausable middleware # add our pausable middleware
config.server_middleware do |chain| config.server_middleware do |chain|
chain.add Sidekiq::Pausable chain.add Sidekiq::Pausable

View File

@ -245,8 +245,14 @@ module Discourse
SiteSetting.after_fork SiteSetting.after_fork
$redis.client.reconnect $redis.client.reconnect
Rails.cache.reconnect Rails.cache.reconnect
# /!\ HACK /!\ force sidekiq to create a new connection to redis # shuts down all connections in the pool
Sidekiq.instance_variable_set(:@redis, nil) Sidekiq.redis_pool.shutdown{|c| nil}
# re-establish
Sidekiq.redis = sidekiq_redis_config
end
def self.sidekiq_redis_config
{ url: $redis.url, namespace: 'sidekiq' }
end end
end end