DEV: Fix not being able to boot Sidekiq server in development (#16696)
This commit is contained in:
parent
907adce1cb
commit
a76256756f
|
@ -27,10 +27,10 @@ if Sidekiq.server?
|
|||
end
|
||||
end
|
||||
|
||||
# defer queue should simply run in sidekiq
|
||||
Scheduler::Defer.async = false
|
||||
|
||||
Rails.application.config.after_initialize do
|
||||
# defer queue should simply run in sidekiq
|
||||
Scheduler::Defer.async = false
|
||||
|
||||
# warm up AR
|
||||
RailsMultisite::ConnectionManagement.safe_each_connection do
|
||||
(ActiveRecord::Base.connection.tables - %w[schema_migrations versions]).each do |table|
|
||||
|
@ -49,17 +49,17 @@ if Sidekiq.server?
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Sidekiq#logger= applies patches to whichever logger we pass it.
|
||||
# Therefore something like Sidekiq.logger = Rails.logger will break
|
||||
# all logging in the application.
|
||||
#
|
||||
# Instead, this patch adds a dedicated logger instance and patches
|
||||
# the #add method to forward messages to Rails.logger.
|
||||
Sidekiq.logger = Logger.new(nil)
|
||||
Sidekiq.logger.define_singleton_method(:add) do |severity, message = nil, progname = nil, &blk|
|
||||
Rails.logger.add(severity, message, progname, &blk)
|
||||
else
|
||||
# Sidekiq#logger= applies patches to whichever logger we pass it.
|
||||
# Therefore something like Sidekiq.logger = Rails.logger will break
|
||||
# all logging in the application.
|
||||
#
|
||||
# Instead, this patch adds a dedicated logger instance and patches
|
||||
# the #add method to forward messages to Rails.logger.
|
||||
Sidekiq.logger = Logger.new(nil)
|
||||
Sidekiq.logger.define_singleton_method(:add) do |severity, message = nil, progname = nil, &blk|
|
||||
Rails.logger.add(severity, message, progname, &blk)
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq.error_handlers.clear
|
||||
|
|
Loading…
Reference in New Issue