Skip to content

Instantly share code, notes, and snippets.

@adamlwatson
Created November 16, 2011 21:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamlwatson/1371577 to your computer and use it in GitHub Desktop.
Save adamlwatson/1371577 to your computer and use it in GitHub Desktop.
Mongoid connection pooling in Goliath
require 'em-synchrony/em-mongo'
require 'mongoid'
mongoid_conn = Mongo::Connection.new 'localhost', 27017, :pool_size => 10
Mongoid.configure do |config|
begin
config.master = mongoid_conn.db('dbname')
rescue Exception=>err
abort "An error occurred while creating the mongoid connection pool: #{err}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment