Sha256: 8944af0c1b698879c29863fb3b1893e52bf00a77524c3f4317928c9d84fd236f

Contents?: true

Size: 602 Bytes

Versions: 35

Compression:

Stored size: 602 Bytes

Contents

require 'sidekiq'
require 'routemaster/jobs/job'

module Routemaster
  module Jobs
    module Backends
      class Sidekiq
        def initialize(adapter = nil)
          @adapter = adapter || ::Sidekiq::Client
        end

        def enqueue(queue, job_class, *args)
          job_data = Job.data_for(job_class, args)
          @adapter.push('queue' => queue, 'class' => JobWrapper, 'args' => [job_data])
        end

        class JobWrapper
          include ::Sidekiq::Worker

          def perform(job_data)
            Job.execute(job_data)
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
routemaster-drain-3.0.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.5.4 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.5.3 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.5.2 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.5.1 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.5.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.4.4 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.4.3 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.4.2 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.4.1 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.4.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.3.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.2.2 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-2.0.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-1.1.0 lib/routemaster/jobs/backends/sidekiq.rb