Sha256: b48ff8057a984bd3390e4e6900ad234e3dd93374454f2136639ab4cf31135520

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

module Resque

  #
  #  Why force one job type into one queue?
  #
  def self.enqueue_to( queue, klass, *args )
    Job.create(queue, klass, *args)
  end

  def self.dequeue_from( queue, klass, *args)
    Job.destroy(queue, klass, *args)
  end

  def self.enqueued?( klass, *args)
    enqueued_in?(queue_from_class(klass), klass, *args )
  end

  def self.enqueued_in?(queue, klass, *args)
    item = { :class => klass.to_s, :args => args }
    return nil unless Resque::Plugins::Loner::Helpers.item_is_a_unique_job?(item)
    Resque::Plugins::Loner::Helpers.loner_queued?(queue, item)
  end

  def self.remove_queue_with_loner_cleanup(queue)
    self.remove_queue_without_loner_cleanup(queue)
    Resque::Plugins::Loner::Helpers.cleanup_loners(queue)
  end


  class << self

    alias_method :remove_queue_without_loner_cleanup, :remove_queue
    alias_method :remove_queue, :remove_queue_with_loner_cleanup

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-loner-1.0.1 lib/resque-ext/resque.rb