Open athityakumar opened 7 years ago
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
@v0dro @zverok - Infact, a similar check could be useful for even RData / RDS IO modules. Please share your insights (any neater methods?). 😄
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 echo ping: 42 | mongo --quiet
is.
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?
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?