Sha256: 7d32f832b1053a66f6cfe860b8ce5e7b1a8e307dff6f3ddf07420407f879f337

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

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

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

          def self.perform_async(*args)
            ::Backburner.enqueue(self, *args)
          end

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multi_worker-0.2.0 lib/multi_worker/adapters/backburner.rb
multi_worker-0.1.0 lib/multi_worker/adapters/backburner.rb