Skip to content

Instantly share code, notes, and snippets.

@mehlah
Created February 5, 2015 20:46
Show Gist options
  • Save mehlah/8d86d10b68f5d9b07c38 to your computer and use it in GitHub Desktop.
Save mehlah/8d86d10b68f5d9b07c38 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
>> 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