Skip to content

Instantly share code, notes, and snippets.

@ono
Created February 12, 2010 12:30
Show Gist options
  • Save ono/302523 to your computer and use it in GitHub Desktop.
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
# 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