4
레일 사이에 Redis 연결 풀을 공유하는 가장 좋은 방법은 무엇입니까 & Sidekiq?Sidekq와 Rails 간 Redis 풀 공유
나는 이니셜 라이저에서 그 일을했습니다
Sidekiq.configure_client do |config|
pool = ConnectionPool.new(size: 1, timeout: 5) { Redis.new(host: redis_config['host'], port: redis_config['port'], db: redis_config['database']) }
config.redis = pool
Redis.current = pool
end
Sidekiq.configure_server do |config|
pool = ConnectionPool.new(size: 10, timeout: 5) { Redis.new(host: redis_config['host'], port: redis_config['port'], db: redis_config['database']) }
config.redis = pool
Redis.current = pool
config.server_middleware do |chain|
chain.add Kiqstand::Middleware
end
end
그러나 Sidekiq 블록에 레일 레디 스 풀을 설정하는 것은 매우 깨끗하지 않다 ... 어떤 아이디어?
제대로 작동합니까? –