Skip to content

Instantly share code, notes, and snippets.

@wpeterson
Created February 17, 2012 18:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wpeterson/c5027d393bc54e202dab to your computer and use it in GitHub Desktop.
class Alpha < WorkerCommand
@queue = :alpha
def self.work
sleep(5)
puts "Alpha"
end
end
$> rake resque:work QUEUE=alpha,beta
Beta
Beta
Beta
Alpha
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
class Beta < WorkerCommand
@queue = :beta
def self.work
sleep(5)
puts "Beta"
end
end
$> rake resque:work QUEUE=beta,alpha
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Beta
Gemfile.lock:231: resque (1.19.0)
Gemfile.lock:236: resque-meta (1.0.3)
Gemfile.lock:237: resque (~> 1.8)
Gemfile.lock:238: resque-scheduler (1.9.9)
Gemfile.lock:240: resque (>= 1.8.0)
Gemfile.lock:242: resque_mailer (1.0.1)
Gemfile.lock:390: resque (= 1.19.0)
Gemfile.lock:391: resque-meta (= 1.0.3)
Gemfile.lock:392: resque-scheduler (= 1.9.9)
Gemfile.lock:393: resque_mailer (= 1.0.1)
>> 100.times { Resque.enqueue Beta }
=> 100
# Wait for both workers to start processing Beta jobs on queue...
# Now add a high-priority Alpha job
>> Resque.enqueue Alpha
=> []
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment