Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #12 from arthurdandrea/master

Disable extensions when Resque.inline? == true
  • Loading branch information...
commit 712b259c96f41eda6b077ea0e6fe9704339b6dc3 2 parents f977f07 + 2aed253
@jayniz jayniz authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/resque-ext/job.rb
View
18 lib/resque-ext/job.rb
@@ -12,11 +12,15 @@ class Job
# after Resque::Job.create has called Resque.push
#
def self.create_with_loner(queue, klass, *args)
- item = { :class => klass.to_s, :args => args }
- return "EXISTED" if Resque::Plugins::Loner::Helpers.loner_queued?(queue, item)
- job = create_without_loner(queue, klass, *args)
- Resque::Plugins::Loner::Helpers.mark_loner_as_queued(queue, item)
- job
+ if Resque.inline?
+ create_without_loner(queue, klass, *args)
+ else
+ item = { :class => klass.to_s, :args => args }
+ return "EXISTED" if Resque::Plugins::Loner::Helpers.loner_queued?(queue, item)
+ job = create_without_loner(queue, klass, *args)
+ Resque::Plugins::Loner::Helpers.mark_loner_as_queued(queue, item)
+ job
+ end
end
#
@@ -24,7 +28,7 @@ def self.create_with_loner(queue, klass, *args)
#
def self.reserve_with_loner(queue)
item = reserve_without_loner(queue)
- Resque::Plugins::Loner::Helpers.mark_loner_as_unqueued( queue, item ) if item
+ Resque::Plugins::Loner::Helpers.mark_loner_as_unqueued( queue, item ) if item && !Resque.inline?
item
end
@@ -35,7 +39,7 @@ def self.reserve_with_loner(queue)
# as the original method Resque::Job.destroy. Couldn't make it any dry'er.
#
def self.destroy_with_loner(queue, klass, *args)
- Resque::Plugins::Loner::Helpers.job_destroy(queue, klass, *args)
+ Resque::Plugins::Loner::Helpers.job_destroy(queue, klass, *args) unless Resque.inline?
destroy_without_loner(queue, klass, *args)
end
Please sign in to comment.
Something went wrong with that request. Please try again.