Fixes rubocop offenses

This commit is contained in:
Muhammad Nawzad 2023-12-06 14:11:35 +03:00
parent 8a95f69556
commit 54025a5aa4
No known key found for this signature in database
GPG Key ID: B954B6AAE33940B2

View File

@ -5,10 +5,12 @@ namespace :rabbit_carrots do
task eat: :environment do
Rails.application.eager_load!
# rubocop:disable Lint/ConstantDefinitionInBlock
DatabaseAgonsticNotNullViolation = defined?(ActiveRecord) ? ActiveRecord::NotNullViolation : RabbitCarrots::EventHandlers::Errors::PlaceholderError
DatabaseAgonsticConnectionNotEstablished = defined?(ActiveRecord) ? ActiveRecord::ConnectionNotEstablished : Mongo::Error::SocketError
DatabaseAgnosticRecordInvalid = defined?(ActiveRecord) ? ActiveRecord::RecordInvalid : Mongoid::Errors::Validations
# rubocop:enable Lint/ConstantDefinitionInBlock
channels = RabbitCarrots.configuration.routing_key_mappings.map do |mapping|
# This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant
{ **mapping, handler: mapping[:handler].constantize }
@ -32,7 +34,7 @@ namespace :rabbit_carrots do
end
end
def run_task(queue_name:, queue_arguments: {}, handler_class:, routing_keys:)
def run_task(queue_name:, handler_class:, routing_keys:, queue_arguments: {})
RabbitCarrots::Connection.instance.channel.with do |channel|
exchange = channel.topic(RabbitCarrots.configuration.event_bus_exchange_name, durable: true)