Skip to content

Instantly share code, notes, and snippets.

@adamlwatson
Created November 16, 2011 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamlwatson/1371170 to your computer and use it in GitHub Desktop.
Save adamlwatson/1371170 to your computer and use it in GitHub Desktop.
Creating a connection pool in Goliath
config['mongo'] = EM::Synchrony::ConnectionPool.new(size:10) do
begin
conn = EM::Mongo::Connection.new('localhost', 27017, 1, {:reconnect_in => 1})
conn.db('mongo_db_name')
rescue Exception=>err
abort "An error occurred while creating the mongodb connection pool: #{err}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment