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.7.1 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.7.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.8 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.7 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.6 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.5 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.4 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.3 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.2 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.1 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.6.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.5.1 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.5.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.4.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.3.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.2.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.1.0 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.0.3 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.0.2 lib/routemaster/jobs/backends/sidekiq.rb
routemaster-drain-3.0.1 lib/routemaster/jobs/backends/sidekiq.rb