Sha256: 771fa69f931086fbcb8573f346269e1fc697c36909c22d51678d6eb424a4d05d

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

module MultiWorker
  module Adapters
    class DelayedJob
      def self.configure(base, opts={})
        base.class_eval do
          @queue = opts[:queue]

          def self.perform(*args)
            self.new.perform(*args)
          end

          def self.perform_async(*args)
            delay(queue: @queue).perform(*args)
          end

          def perform_async(*args)
            self.class.perform_async(*args)
          end
        end
      end

      def self.rake_task
        require 'rake'
        require 'delayed/tasks'

        ::Rake::Task['jobs:work']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_worker-0.2.0 lib/multi_worker/adapters/delayed_job.rb