Created
February 12, 2010 12:30
-
-
Save ono/302523 to your computer and use it in GitHub Desktop.
Allow you to develop codebase using Resque without running worker and setting up redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some developers (or designers) in your project might not need resque running in local nor want to hasstle to set up redis. | |
# For helping such lazy people, I give you a option. | |
# Put and customize this code from Rails initializers, Sinatra configuration block, or wherever. | |
require 'resque' | |
if ENV["RAILS_ENV"]=="development" # <= Change this condition as you like | |
module Resque | |
# Performs job immediately without queueing. | |
def perform_immediately(queue, item) | |
item = decode(encode(item)) | |
job = Job.new(queue, item) | |
job.perform | |
end | |
alias_method :orig_push, :push | |
alias_method :push, :perform_immediately | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment