Sha256: 852becadd9344417e689963321c0896192ae4c0ac493a27d0a7d87151bee0a72

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

# frizen_string_literal: true

require_relative './shared_class_methods'

module MultiBackgroundJob
  module Workers
    module Sidekiq
      def self.extended(base)
        base.include(::Sidekiq::Worker) if defined?(::Sidekiq)
        base.extend SharedClassMethods
        base.extend ClassMethods
      end

      module ClassMethods
        def service_worker_options
          default_queue = MultiBackgroundJob.config.workers.dig(self.name, :queue)
          default_retry = MultiBackgroundJob.config.workers.dig(self.name, :retry)
          default_queue ||= ::Sidekiq.default_worker_options['queue'] if defined?(::Sidekiq)
          default_retry ||= ::Sidekiq.default_worker_options['retry'] if defined?(::Sidekiq)
          {
            queue: (default_queue || 'default'),
            retry: (default_retry || 15),
          }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi-background-job-0.1.0 lib/multi_background_job/workers/sidekiq.rb