Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for auto reconnect #14

Open
wereHamster opened this issue Aug 26, 2013 · 9 comments
Open

Support for auto reconnect #14

wereHamster opened this issue Aug 26, 2013 · 9 comments

Comments

@wereHamster
Copy link

It would be nice to have this option so that the driver automatically reconnects to the server if the connection goes down.

@gregwebs
Copy link

gregwebs commented Sep 2, 2013

can you give more details on this? Is this an option that should be set?

@wereHamster
Copy link
Author

Some other mongodb drivers have an option, called something like auto_reconnect, which will instruct the driver to automatically reconnect to the server if the connection goes down (due to server restart, or when a replica set elects a new master).

Examples from other drivers:

@gregwebs
Copy link

gregwebs commented Sep 2, 2013

Why not always attempt to automatically re-connect? I am wondering if this is functionality that can be built into resource-pool rather than mongoDB. Probably should switch to resource-pool before trying to implement this.

@wereHamster
Copy link
Author

Automatic reconnect by default? That would work for me as well :)

@gregwebs
Copy link

gregwebs commented Sep 4, 2013

I saw this in my error logs:

PersistMongoDBError "ConnectionFailure <socket: 4>: hGetBuf: resource vanished (Connection reset by peer)"

Is that what you saw also? (Minus the Persist wrapper if you aren't using persistent)

@wereHamster
Copy link
Author

I don't have access the the logs anymore. But the symptom was that after I restarted, the application didn't work anymore.

@gregwebs
Copy link

gregwebs commented Sep 4, 2013

after you restarted the database?

@wereHamster
Copy link
Author

Oh, I deleted too much text while editing the comment, should have read 'after I restarted mongodb, the app...'

@gregwebs
Copy link

gregwebs commented Sep 4, 2013

I was easily able to write a one-off for mongodb-queue that does this

https://github.com/docmunch/haskell-mongodb-queue/blob/master/Database/MongoDB/Queue.hs#L158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants