Skip to content

Instantly share code, notes, and snippets.

@gregorymostizky
gregorymostizky / mysql2_connection_pool.rb
Created February 1, 2011 15:06
Simple connection pool for evented mysql2
require 'mysql2'
require 'mysql2/em'
class MysqlConnectionPool
def initialize(conf)
@pool_size = conf[:size] || 10
@connections = []
@query_queue = EM::Queue.new
start_queue conf