Created
October 26, 2010 18:15
-
-
Save jimmys/647464 to your computer and use it in GitHub Desktop.
Example of em-mysqlplus
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 'fiber' | |
require 'em-synchrony' | |
require 'em-mysqlplus' | |
require 'benchmark' | |
EventMachine.synchrony do | |
db = EventMachine::Synchrony::ConnectionPool.new(size: 5) do | |
EventMachine::MySQL.new(host: 'localhost') | |
end | |
multi = EventMachine::Synchrony::Multi.new | |
multi.add :a, db.aquery("select sleep(1)") | |
multi.add :b, db.aquery("select sleep(1)") | |
res = multi.perform | |
p res | |
EventMachine.stop | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep, that did it. Thank you!