Skip to content

Instantly share code, notes, and snippets.

@cluesque
Created April 8, 2010 18:43
Show Gist options
  • Select an option

  • Save cluesque/360382 to your computer and use it in GitHub Desktop.

Select an option

Save cluesque/360382 to your computer and use it in GitHub Desktop.
# Include this in your development and test environments
# if you want to run all Resque processors inline
# (avoiding the need for Redis and a separate worker process)
# In config/environments/{development,test}.rb:
# config.after_initialize do
# require 'resque_inline'
# end
module Resque
def enqueue_with_environment_checking(klass, *args)
if ENV['USE_REDIS'].blank?
klass.perform(*args)
"OK"
else
enqueue_without_environment_checking(klass, *args)
end
end
class << self
alias_method_chain :enqueue, :environment_checking
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment