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
does not re-connect #34
Comments
This can be done by setting one of the serverConfig properties of the mongodb.Db instance:
Unfortunately, I don't understand node-mongolian very well, and I can't see where and if there is an exposed mongodb.Db instance. |
Maybe this could be done through
but I am not sure. |
Mongolian DB doesn't use the mongodb-native Db class, so the above will not work. Mongolian DB should automatically reconnect automatically the next time you try to use it (though it doesn't currently proactively reconnect). Can you give a test case of what's not working for you? |
I guess this is more integration testing not sure how easy to put that into a test. But this is how I can easily reproduce it
Expected behavior: mongolian just re-connects to mongo |
Ok, I made the following nodeunit test, ran it, then stopped my mongo server replicaset primary (I'm running two mongods and a mediator), and while it takes a few seconds to switch primaries and get connected again, it does eventually reconnect. This process could probably be improved (automatically retry for x seconds before failing), but the current approach is pretty low-level and low-latency. Perhaps as part of the connection pooling work I can look into some options here.
nodeunit test/reruntest.js
|
Nice but that test case does not really resemble the situation. Try running this instead:
and what I get is
|
Please re-open, I don't have the permission to. |
Ok, that looks pretty bad. Thanks for the test case. |
Hi, To temporarily fix the problem, I've added a value() method to taxman, implemented as
And changed server.js to use that instead:
Not particularly elegant, but it fixed the problem for me. Ciao, |
You guys are awesome. I appreciate your tracking this down. Apparently I have some changes to my local copy of taxman that I've forgotten to commit/publish. They should be available now. |
When mongodb gets restarted the node app loses the connection is no longer working. Mongolian should just re-connect in such an event.
The text was updated successfully, but these errors were encountered: