Class: Resque::Job
- Inherits:
-
Object
- Object
- Resque::Job
- Defined in:
- lib/resque_ext/job.rb
Class Method Summary collapse
-
.create_solo(queue, klass, *args) ⇒ Object
(also: create)
Mark an item as queued.
-
.destroy_solo(queue, klass, *args) ⇒ Object
(also: destroy)
Mark destroyed jobs as unqueued.
-
.reserve_solo(queue) ⇒ Object
(also: reserve)
Mark an item as unqueued.
Class Method Details
.create_solo(queue, klass, *args) ⇒ Object Also known as: create
Mark an item as queued
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/resque_ext/job.rb', line 7 def create_solo(queue, klass, *args) item = { class: klass.to_s, args: args } if Resque.inline? || !ResqueSolo::Queue.is_unique?(item) return create_without_solo(queue, klass, *args) end return "EXISTED" if ResqueSolo::Queue.queued?(queue, item) create_return_value = false # redis transaction block Resque.redis.multi do create_return_value = create_without_solo(queue, klass, *args) ResqueSolo::Queue.mark_queued(queue, item) end create_return_value end |
.destroy_solo(queue, klass, *args) ⇒ Object Also known as: destroy
Mark destroyed jobs as unqueued
30 31 32 33 |
# File 'lib/resque_ext/job.rb', line 30 def destroy_solo(queue, klass, *args) ResqueSolo::Queue.destroy(queue, klass, *args) unless Resque.inline? destroy_without_solo(queue, klass, *args) end |
.reserve_solo(queue) ⇒ Object Also known as: reserve
Mark an item as unqueued
23 24 25 26 27 |
# File 'lib/resque_ext/job.rb', line 23 def reserve_solo(queue) item = reserve_without_solo(queue) ResqueSolo::Queue.mark_unqueued(queue, item) if item && !Resque.inline? item end |