carlos8f / haredis

High-availability redis in Node.js.
https://npmjs.org/package/haredis
154 stars 21 forks source link

How can you get a timeout for a command on a haredis connection? #3

Closed nickminutello closed 12 years ago

nickminutello commented 12 years ago

Currently, if a majority of the redis servers are not up, the commands get queued forever until a majority is up. There doesn't seem to be a way to specify a timeout for a command... (e.g. a ping - to see if redis is happy) such that we get an error when a majority the servers are down (ie !client.ready) for an extended period of time.

Any thoughts on how to do this?

carlos8f commented 12 years ago

maybe something like this: https://gist.github.com/3624031

carlos8f commented 12 years ago

Also, having a majority of servers down is a pretty bad thing (tm)... which haredis doesn't attempt to solve. adding more servers is the obvious solution, possibly in different datacenters, with the goal that only one or two go down at any time.

nickminutello commented 12 years ago

Sure. I would just prefer the caller was able to detect an error rather than see no response at all?