mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:52:11 +08:00
UPGRADE: sidekiq to sidekiq 3.0
This commit is contained in:
parent
8abf652dc3
commit
c6f9cc0787
|
@ -318,9 +318,9 @@ GEM
|
|||
shoulda-context (1.1.6)
|
||||
shoulda-matchers (2.5.0)
|
||||
activesupport (>= 3.0.0)
|
||||
sidekiq (2.17.6)
|
||||
sidekiq (3.0.0)
|
||||
celluloid (>= 0.15.2)
|
||||
connection_pool (>= 1.0.0)
|
||||
connection_pool (>= 2.0.0)
|
||||
json
|
||||
redis (>= 3.0.6)
|
||||
redis-namespace (>= 1.3.1)
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
require "sidekiq/pausable"
|
||||
|
||||
sidekiq_redis = { url: $redis.url, namespace: 'sidekiq' }
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = sidekiq_redis
|
||||
config.redis = Discourse.sidekiq_redis_config
|
||||
end
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = sidekiq_redis
|
||||
config.redis = Discourse.sidekiq_redis_config
|
||||
# add our pausable middleware
|
||||
config.server_middleware do |chain|
|
||||
chain.add Sidekiq::Pausable
|
||||
|
|
|
@ -245,8 +245,14 @@ module Discourse
|
|||
SiteSetting.after_fork
|
||||
$redis.client.reconnect
|
||||
Rails.cache.reconnect
|
||||
# /!\ HACK /!\ force sidekiq to create a new connection to redis
|
||||
Sidekiq.instance_variable_set(:@redis, nil)
|
||||
# shuts down all connections in the pool
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user