Skip to content

Instantly share code, notes, and snippets.

@marceldegraaf
Created April 26, 2010 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marceldegraaf/379344 to your computer and use it in GitHub Desktop.
Save marceldegraaf/379344 to your computer and use it in GitHub Desktop.
require 'resque'
require 'worker'
module Prototype
class App
def do_background_stuff
Resque.enqueue(Worker)
end
end
end
proto = Prototype::App.new
10_000.times do |i|
proto.do_background_stuff
end
require 'worker'
require 'resque/tasks'
module Prototype
class Worker
@queue = :prototype
def self.perform
puts 'Background job started'
time = sleep(10 + rand(10))
puts "Background job stopped. Took #{time} seconds."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment