Skip to content

Instantly share code, notes, and snippets.

@lgs
Forked from adamlwatson/gist:1371577
Created July 7, 2012 22:50
Show Gist options
  • Save lgs/3068455 to your computer and use it in GitHub Desktop.
Save lgs/3068455 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