{"action":"closed","issue":{"url":"https://api.github.com/repos/taskrabbit/node-resque/issues/72","labels_url":"https://api.github.com/repos/taskrabbit/node-resque/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/taskrabbit/node-resque/issues/72/comments","events_url":"https://api.github.com/repos/taskrabbit/node-resque/issues/72/events","html_url":"https://github.com/taskrabbit/node-resque/issues/72","id":60825405,"number":72,"title":"Multiworker cleanup error","user":{"login":"nathanbowser","id":203161,"avatar_url":"https://avatars.githubusercontent.com/u/203161?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanbowser","html_url":"https://github.com/nathanbowser","followers_url":"https://api.github.com/users/nathanbowser/followers","following_url":"https://api.github.com/users/nathanbowser/following{/other_user}","gists_url":"https://api.github.com/users/nathanbowser/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanbowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanbowser/subscriptions","organizations_url":"https://api.github.com/users/nathanbowser/orgs","repos_url":"https://api.github.com/users/nathanbowser/repos","events_url":"https://api.github.com/users/nathanbowser/events{/privacy}","received_events_url":"https://api.github.com/users/nathanbowser/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-12T14:19:00Z","updated_at":"2015-03-12T14:19:49Z","closed_at":"2015-03-12T14:19:49Z","body":"My app hit an error last night in the multiWorker.workerCleanup function:\r\n\r\n```\r\n TypeError: Object {\"class\":\"jobClass,\"queue\":\"squeegee\",\"args\":[\"someId\",\"abc123\"]} has no method 'forEach'\r\n        at /home/app/code/node_modules/node-resque/lib/worker.js:283:15\r\n        at try_callback (/home/app/code/node_modules/node-resque/node_modules/redis/index.js:592:9)\r\n        at RedisClient.return_reply (/home/app/code/node_modules/node-resque/node_modules/redis/index.js:685:13)\r\n        at ReplyParser.<anonymous> (/home/app/code/node_modules/node-resque/node_modules/redis/index.js:321:14)\r\n        at ReplyParser.emit (events.js:95:17)\r\n        at ReplyParser.send_reply (/home/app/code/node_modules/node-resque/node_modules/redis/lib/parser/javascript.js:300:10)\r\n        at ReplyParser.execute (/home/app/code/node_modules/node-resque/node_modules/redis/lib/parser/javascript.js:203:22)\r\n        at RedisClient.on_data (/home/app/code/node_modules/node-resque/node_modules/redis/index.js:547:27)\r\n        at Socket.<anonymous> (/home/app/code/node_modules/node-resque/node_modules/redis/index.js:102:14)\r\n        at Socket.emit (events.js:95:17)\r\n        at Socket.<anonymous> (_stream_readable.js:765:14)\r\n        at Socket.emit (events.js:92:17)\r\n        at emitReadable_ (_stream_readable.js:427:10)\r\n        at emitReadable (_stream_readable.js:423:5)\r\n        at readableAddChunk (_stream_readable.js:166:9)\r\n        at Socket.Readable.push (_stream_readable.js:128:10)\r\n        at TCP.onread (net.js:529:21)\r\n```\r\n\r\nI did some googling, and it looks like this may have been caused by something in node-redis. I can *kind of* reproduce this by throwing this block somewhere in the code\r\n\r\n```javascript\r\nredis.monitor(function (err, res) { })\r\n```\r\n\r\nI say *kind of* because pretty much all redis command then fail. I also don't think this caused the problem I ran into because my app didn't enter monitor mode. I think it may have been some other node-redis error.\r\n\r\nWe should probably handle errors instead of ignore them in workerCleanup. \r\n\r\n```\r\nself.getPids(function(err, pids){\r\n    self.connection.redis.smembers(self.connection.key('workers'), function(err, workers){\r\n     // TODO err is ignored. \r\n      workers.forEach(function(w){\r\n``"}}