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

Handle Mongo & Redis timeouts? #45

Open
athityakumar opened this issue Aug 3, 2017 · 7 comments
Open

Handle Mongo & Redis timeouts? #45

athityakumar opened this issue Aug 3, 2017 · 7 comments
Labels

Comments

@athityakumar
Copy link
Member

@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?

@v0dro
Copy link
Member

v0dro commented Aug 4, 2017

Is there a way to manually check whether Mongo is installed without having to trigger the mechanism timout error?

@athityakumar
Copy link
Member Author

@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

@athityakumar
Copy link
Member Author

@v0dro @zverok - Infact, a similar check could be useful for even RData / RDS IO modules. Please share your insights (any neater methods?). 😄

@zverok
Copy link
Collaborator

zverok commented Aug 9, 2017

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.

@athityakumar
Copy link
Member Author

@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.

@athityakumar
Copy link
Member Author

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?

@zverok
Copy link
Collaborator

zverok commented Aug 31, 2017

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!

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

No branches or pull requests

3 participants