{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/kue/issues/949","repository_url":"https://api.github.com/repos/Automattic/kue","labels_url":"https://api.github.com/repos/Automattic/kue/issues/949/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/kue/issues/949/comments","events_url":"https://api.github.com/repos/Automattic/kue/issues/949/events","html_url":"https://github.com/Automattic/kue/issues/949","id":178273320,"number":949,"title":"Error: Redis connection to 127.0.0.1:6379 failed - connect EMFILE 12","user":{"login":"devarajc","id":5644026,"avatar_url":"https://avatars.githubusercontent.com/u/5644026?v=3","gravatar_id":"","url":"https://api.github.com/users/devarajc","html_url":"https://github.com/devarajc","followers_url":"https://api.github.com/users/devarajc/followers","following_url":"https://api.github.com/users/devarajc/following{/other_user}","gists_url":"https://api.github.com/users/devarajc/gists{/gist_id}","starred_url":"https://api.github.com/users/devarajc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devarajc/subscriptions","organizations_url":"https://api.github.com/users/devarajc/orgs","repos_url":"https://api.github.com/users/devarajc/repos","events_url":"https://api.github.com/users/devarajc/events{/privacy}","received_events_url":"https://api.github.com/users/devarajc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-21T07:57:24Z","updated_at":"2016-09-22T06:11:16Z","closed_at":null,"body":"Im new to the kue api.  When I try to create more than 1000 queues using loop,  node js throwing  an **Error: Redis connection to 127.0.0.1:6379 failed - connect EMFILE 12**\r\n\r\nMy question is \r\n1. basically  doing anything wrong?\r\n2. need to close the queue some where?\r\n\r\nvar kue = require('kue');\r\nconst queue = kue.createQueue();\r\nvar counter = 0;\r\n\r\nfunction createJob(i) {\r\n\r\n    var job = queue.create('email' + i, {\r\n        title: 'welcome email for tj',\r\n        to: 'tj@learnboost.com',\r\n        template: 'welcome-email'\r\n    }).attempts(5).save(function(err) {\r\n        //if (!err) //console.log(job.id);\r\n    });\r\n\r\n\r\n    queue.process('email' + i, function(job, done) {\r\n        email(job.data, done);\r\n    });\r\n\r\n\r\n    function email(address, done) {\r\n        console.log(\"hey............\", address);\r\n        ++counter;\r\n        done()\r\n    }\r\n}\r\n\r\nqueue.on('job enqueue', function(id, type) {\r\n    //console.log( 'Job %s got queued of type %s', id, type );\r\n\r\n}).on('job complete', function(id, result) {\r\n\r\n    console.log(\"done......\", id, result);\r\n    kue.Job.get(id, function(err, job) {\r\n        if (err) return;\r\n        job.remove(function(err) {\r\n            if (err) throw err;\r\n            console.log('removed completed job #%d', job.id);\r\n            console.log(new Date());\r\n            console.log(\"counter\", counter);\r\n        });\r\n\r\n    });\r\n});\r\n\r\nfor (var i = 0; i < 1000; i++) {\r\n    createJob(i);\r\n}\r\n\r\n\r\n**Console Error** \r\nevents.js:154\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: Redis connection to 127.0.0.1:6379 failed - connect EMFILE 127.0.0.1:6379 - Local (undefined:undefined)\r\n    at Object.exports._errnoException (util.js:893:11)\r\n    at exports._exceptionWithHostPort (util.js:916:20)\r\n    at connect (net.js:863:16)\r\n    at net.js:951:9\r\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n    at process._tickCallback (internal/process/next_tick.js:98:9)\r\n    at Function.Module.runMain (module.js:449:11)\r\n    at startup (node.js:148:18)\r\n    at node.js:405:3\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/kue/issues/comments/248820723","html_url":"https://github.com/Automattic/kue/issues/949#issuecomment-248820723","issue_url":"https://api.github.com/repos/Automattic/kue/issues/949","id":248820723,"user":{"login":"peterporfy","id":656554,"avatar_url":"https://avatars.githubusercontent.com/u/656554?v=3","gravatar_id":"","url":"https://api.github.com/users/peterporfy","html_url":"https://github.com/peterporfy","followers_url":"https://api.github.com/users/peterporfy/followers","following_url":"https://api.github.com/users/peterporfy/following{/other_user}","gists_url":"https://api.github.com/users/peterporfy/gists{/gist_id}","starred_url":"https://api.github.com/users/peterporfy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterporfy/subscriptions","organizations_url":"https://api.github.com/users/peterporfy/orgs","repos_url":"https://api.github.com/users/peterporfy/repos","events_url":"https://api.github.com/users/peterporfy/events{/privacy}","received_events_url":"https://api.github.com/users/peterporfy/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T06:11:16Z","updated_at":"2016-09-22T06:11:16Z","body":"It depends on what you. Nodejs itself is single threaded so keep that in mind."}}
{"actor":{"display_login":"peterporfy"}}