daru-io icon indicating copy to clipboard operation
daru-io copied to clipboard

Handle Mongo & Redis timeouts?

Open athityakumar opened this issue 8 years ago • 7 comments

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

athityakumar avatar Aug 03 '17 20:08 athityakumar

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

v0dro avatar Aug 04 '17 05:08 v0dro

@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 avatar Aug 06 '17 01:08 athityakumar

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

athityakumar avatar Aug 08 '17 14:08 athityakumar

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 avatar Aug 09 '17 19:08 zverok

@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 avatar Aug 31 '17 21:08 athityakumar

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?

athityakumar avatar Aug 31 '17 21:08 athityakumar

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!

zverok avatar Aug 31 '17 21:08 zverok