Sha256: 0b9a1f9415168b749f7f006d80bd697a9497858a313f5ab27203b1df4b9b33af

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

# frizen_string_literal: true

require_relative './shared_class_methods'

module MultiBackgroundJob
  module Workers
    module Faktory
      def self.extended(base)
        base.include(::Faktory::Job) if defined?(::Faktory)
        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 ||= ::Faktory.default_job_options['queue'] if defined?(::Faktory)
          default_retry ||= ::Faktory.default_job_options['retry'] if defined?(::Faktory)
          {
            queue: (default_queue || 'default'),
            retry: (default_retry || 25),
          }
        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/faktory.rb