Created
April 26, 2010 13:48
-
-
Save marceldegraaf/379344 to your computer and use it in GitHub Desktop.
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
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 |
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
require 'worker' | |
require 'resque/tasks' |
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
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