Sha256: df0abc601cce7d390ec60b410a11fc26e8d3ca00d96b3bd4ec8254118ab0f6be

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

# rubocop:disable FileName
require 'yaml' if RUBY_VERSION.include?('2.0.0')
require 'sidekiq_unique_jobs/middleware'
require 'sidekiq_unique_jobs/version'
require 'sidekiq_unique_jobs/config'
require 'sidekiq_unique_jobs/payload_helper'
require 'ostruct'

module SidekiqUniqueJobs
  module_function

  def config
    @config ||= Config.new(
      unique_prefix: 'sidekiq_unique',
      unique_args_enabled: false,
      default_expiration: 30 * 60,
      default_unlock_order: :after_yield
    )
  end

  def unique_args_enabled?
    config.unique_args_enabled
  end

  def configure
    yield config
  end

  # Attempt to constantize a string worker_class argument, always
  # failing back to the original argument.
  def worker_class_constantize(worker_class)
    return worker_class unless worker_class.is_a?(String)
    worker_class.constantize
  rescue NameError
    worker_class
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-3.0.12 lib/sidekiq-unique-jobs.rb
sidekiq-unique-jobs-3.0.11 lib/sidekiq-unique-jobs.rb
sidekiq-unique-jobs-3.0.10 lib/sidekiq-unique-jobs.rb