Created
February 5, 2015 20:46
-
-
Save mehlah/8d86d10b68f5d9b07c38 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
class Alpha < WorkerCommand | |
@queue = :alpha | |
def self.work | |
sleep(5) | |
puts "Alpha" | |
end | |
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
$> rake resque:work QUEUE=alpha,beta | |
Beta | |
Beta | |
Beta | |
Alpha | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta |
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
class Beta < WorkerCommand | |
@queue = :beta | |
def self.work | |
sleep(5) | |
puts "Beta" | |
end | |
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
$> rake resque:work QUEUE=beta,alpha | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta | |
Beta |
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
>> 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