我希望Sidekiq支持同一个项目的多个动态数据库
desc "Start sending the client invitation"
task "sidekiq:start", [:database] => :environment do |task, args|
database = args[:database]
config = ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:host => "localhost",
:username => "postgres",
:password => 12345678,
:database => database
)
puts "Start Running Sidkiq Server for new database instance - #{database}"
system("bundle exec sidekiq -d -L log/sidekiq.log -P tmp/pids/#{database}_sidekiq.pid")
puts "Finished Running Sidkiq Server for new database instance - #{database}"
puts "Finished connecting the client sidkiq"
end
rake sidekiq:start[hellodb]
sidekiq中有什么动态传递数据库配置吗?
config = ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:host => "localhost",
:username => "postgres",
:password => 12345678,
:database => database
)
我会欣赏同样的意见:)