From 54025a5aa460bd28f915e2e3a727afe7d3dc2c16 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Wed, 6 Dec 2023 14:11:35 +0300 Subject: [PATCH] Fixes rubocop offenses --- lib/rabbit_carrots/tasks/rmq.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rabbit_carrots/tasks/rmq.rake b/lib/rabbit_carrots/tasks/rmq.rake index 6706b7b..a8c5830 100644 --- a/lib/rabbit_carrots/tasks/rmq.rake +++ b/lib/rabbit_carrots/tasks/rmq.rake @@ -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)