retrospring/config/initializers/15_sidekiq.rb
Karina Kwiatek 91d3db4034 Move rpush init/exit logic into Sidekiq initializer
Co-authored-by: nilsding <nilsding@nilsding.org>
2023-01-02 11:50:48 +01:00

21 lines
530 B
Ruby

require "rpush/daemon"
require "rpush/daemon/store/active_record"
require "rpush/client/active_record"
redis_url = ENV.fetch("REDIS_URL") { APP_CONFIG["redis_url"] }
Sidekiq.configure_server do |config|
config.redis = { url: redis_url }
Rpush.config.push = true
Rpush::Daemon.store = Rpush::Daemon::Store::ActiveRecord.new
Rpush::Daemon.common_init
Rpush::Daemon::Synchronizer.sync
at_exit do
Rpush::Daemon::AppRunner.stop
end
end
Sidekiq.configure_client do |config|
config.redis = { url: redis_url }
end