Created
November 9, 2011 20:16
-
-
Save takai/1352847 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'rubygems' | |
require 'bundler/setup' | |
require 'mysql2' | |
require 'active_record' | |
require 'logger' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql2', | |
:host => 'localhost', | |
:database => 'test', | |
:username => 'root', | |
:pool => 1) | |
class Employee < ActiveRecord::Base | |
end | |
ts = [] | |
10.times do | |
ts << Thread.new do | |
ActiveRecord::Base.connection_pool.with_connection do | |
Employee.all | |
end | |
end | |
end | |
ts.each { |t| t.join } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment