technoweenie/coffee-resque — pull request #31 by jasonbosco (2012-10-30 00:11:54+00:00)
Title: Worker.end() does not delete all keys in redis

When I call `worker.end()` on a running worker, it does not delete all the associated keys in redis. The problem is that according to the [node redis library documentation]((https://github.com/bnoguchi/redis-node#clientdelkey1-key2--keyn-callback), the way to delete multiple keys is
```
client.del(key1, key2, ..., keyn, callback)
```
But in coffee-resque, multiple keys are [passed as an array](https://github.com/technoweenie/coffee-resque/blob/master/src/index.coffee#L122) instead of [individual parameters](https://github.com/jasonbosco/coffee-resque/blob/master/src/index.coffee#L125).

Here's a trace from redis' `monitor` command when I call `worker.end()` :+1:

**Before applying my fix**

```
1351551290.814186 "srem" "resque:workers" "node:98309:temp"
1351551290.814216 "del" "resque:worker:node:98309:temp,resque:worker:node:98309:temp:started,resque:stat:failed:node:98309:temp,resque:stat:processed:node:98309:temp"
```
*Note how all the parameters passed as the first argument (as an array) are `join`ed together with a `,` and hence redis treats it as one long key.*

**After applying my fix**

```
1351554029.511565 "srem" "resque:workers" "node:98400:temp"
1351554029.511627 "del" "resque:worker:node:98400:temp" "resque:worker:node:98400:temp:started" "resque:stat:failed:node:98400:temp" "resque:stat:processed:node:98400:temp"
```
*This successfully deletes all the keys*