-
Notifications
You must be signed in to change notification settings - Fork 9
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
Handle Mongo & Redis timeouts? #45
Comments
Is there a way to manually check whether Mongo is installed without having to trigger the mechanism timout error? |
@v0dro - I don't think there's a way within the gem, but checking with backticks / system calls for CLI commands would work (though hacky) - $ echo ping: 42 | mongo --quiet
42
$ redis-cli ping
PONG |
Have no reasonable idea at the moment, to be honest. Probably we should just catch default "Can't connect"/timeout error and assume that target platform is not installed/running and suggest something about it. In fact, I don't think this task worth a lot of effort, because "tries to connect but forgot to run it is a marginal case, and just clear indication of "something went wrong" should be enough. |
@zverok - Hmm, but I think Prasun's point was about why it should take time (1 minute-ish) to finally just throw a "Timeout error", when it could rather be just "Please install Mongo" without waiting for a "Timeout error" when Mongo isn't installed. Hence, I suggested the hacky workaround that |
Now that the README, Contribution Guidelines and YARD Docs are documenting the points well, should we probably should just trust that the user will go through any one of these sources? |
I believe so! |
@prasunanand - Thanks for pointing this out during the code review conference, I had missed to handle this error. But thinking about it, I'm not sure whether it should be handled.
For example, Mongo raises a TimeOut error when no results are obtained in 30 seconds. So, it anyway has to wait for 30 seconds (in case of error) to raise the TimeOut error. So, handling this wouldn't make the tests faster in case Mongo isn't installed (as it'll always take 30 seconds before reporting a TimeOut error). Similar issue with Redis too.
Also, TimeOut error is quite communicative to the user.
Installation of Redis & Mongo should definitely be added in the README. But, should the TimeOut error be handled or left to be raised?
The text was updated successfully, but these errors were encountered: