Sha256: 0bd334377ba397e57f34d4e29979db8518c44c045d8ca625d973e0256c07b544

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require "sidekiq"

module SidekiqUniqueJobs
  #
  # Provides the sidekiq middleware that makes the gem work
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  #
  module Middleware
    def self.extended(base)
      base.class_eval do
        configure_middleware
      end
    end

    def configure_middleware
      configure_server_middleware
      configure_client_middleware
    end

    def configure_server_middleware
      Sidekiq.configure_server do |config|
        config.client_middleware do |chain|
          require "sidekiq_unique_jobs/client/middleware"
          chain.add SidekiqUniqueJobs::Client::Middleware
        end

        config.server_middleware do |chain|
          require "sidekiq_unique_jobs/server/middleware"
          chain.add SidekiqUniqueJobs::Server::Middleware
        end
      end
    end

    def configure_client_middleware
      Sidekiq.configure_client do |config|
        config.client_middleware do |chain|
          require "sidekiq_unique_jobs/client/middleware"
          chain.add SidekiqUniqueJobs::Client::Middleware
        end
      end
    end
  end
end
SidekiqUniqueJobs.extend SidekiqUniqueJobs::Middleware

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.24 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.23 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.22 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.21 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.20 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.16 lib/sidekiq_unique_jobs/middleware.rb
sidekiq-unique-jobs-6.0.19 lib/sidekiq_unique_jobs/middleware.rb