Module: Resque

Defined in:
lib/resque-ext/job.rb,
lib/resque-ext/resque.rb,
lib/resque-loner/helpers.rb,
lib/resque-loner/version.rb,
lib/resque-loner/unique_job.rb,
lib/resque-loner/unique_job.rb

Overview

If you want your job to be unique, include this module in it. If you wish,

you can overwrite this implementation of redis_key to fit your needs

Defined Under Namespace

Modules: Plugins Classes: Job

Class Method Summary collapse

Class Method Details

.enqueued?(klass, *args) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/resque-ext/resque.rb', line 3

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

.enqueued_in?(queue, klass, *args) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/resque-ext/resque.rb', line 7

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

.remove_queue_with_loner_cleanup(queue) ⇒ Object Also known as: remove_queue



13
14
15
16
# File 'lib/resque-ext/resque.rb', line 13

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