Remove calls to MongoServer.Disconnect #2

Closed
AdaTheDev opened this Issue Jan 23, 2013 · 1 comment

Comments

Projects
None yet
1 participant
@AdaTheDev
Owner

AdaTheDev commented Jan 23, 2013

Via a comment on original blog post:
"We've found through load testing this code has the following problem: it calls the "disconnect" method on the server object in several places. This may cause the Mongo driver to run out of connections and fail to connect to the server.

It turns out that the disconnect should not usually be invoked; it's better to let the driver handle the connection pooling internally.

See for example this blog post: http://craiggwilson.wordpress.com/2012/09/23/disconnecting-with-the-mongodb-driver/"

Bottom line, is that there is no need to call Disconnect() on a MongoServer instance. The API docs for the C# (http://api.mongodb.org/csharp/1.6/html/71b2d2c6-4c2d-ec27-b465-071dee0dd2f6.htm) state: "Disconnects from the server. Normally there is no need to call this method so you should be sure to have a good reason to call it." - I have no good reason to call it, so will remove those calls.

@AdaTheDev

This comment has been minimized.

Show comment Hide comment
@AdaTheDev

AdaTheDev Jan 23, 2013

Owner

Fixed.

Owner

AdaTheDev commented Jan 23, 2013

Fixed.

@AdaTheDev AdaTheDev closed this Jan 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment