mranney/node_redis — pull request #184 by pconstr (2012-03-06 20:58:01+00:00)
Title: error handling with multi / exec

I've been trying to make a node.js app resilient to redis disconnections.

This app keeps a lot of context besides connections to multiple redis databases, so restarting it fully is undesirable.

Resilience to disconnections seems to be achievable in most cases, but I haven't found a clean way to completely handle errors in `multi` - `exec`.

The proposed changes address a couple of issues (in my understanding):

- There's no way to associate a callback with the `multi` command itself. so if `multi` itself fails, `node_redis` will throw and all is lost. I propose one way of doing this
- There's a bug in the code that removes failed commands from the queue. Splicing them out by (the original) index will not work correctly as the removals (in increasing index order) will shift elements in the array

I'm also throwing in a commit to fix a trivial problem in `package.json`