{"action":"created","issue":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/1141","repository_url":"https://api.github.com/repos/OptimalBits/bull","labels_url":"https://api.github.com/repos/OptimalBits/bull/issues/1141/labels{/name}","comments_url":"https://api.github.com/repos/OptimalBits/bull/issues/1141/comments","events_url":"https://api.github.com/repos/OptimalBits/bull/issues/1141/events","html_url":"https://github.com/OptimalBits/bull/issues/1141","id":385184688,"node_id":"MDU6SXNzdWUzODUxODQ2ODg=","number":1141,"title":"Unhandled promise rejections still occur","user":{"login":"joakimbeng","id":1427383,"node_id":"MDQ6VXNlcjE0MjczODM=","avatar_url":"https://avatars2.githubusercontent.com/u/1427383?v=4","gravatar_id":"","url":"https://api.github.com/users/joakimbeng","html_url":"https://github.com/joakimbeng","followers_url":"https://api.github.com/users/joakimbeng/followers","following_url":"https://api.github.com/users/joakimbeng/following{/other_user}","gists_url":"https://api.github.com/users/joakimbeng/gists{/gist_id}","starred_url":"https://api.github.com/users/joakimbeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakimbeng/subscriptions","organizations_url":"https://api.github.com/users/joakimbeng/orgs","repos_url":"https://api.github.com/users/joakimbeng/repos","events_url":"https://api.github.com/users/joakimbeng/events{/privacy}","received_events_url":"https://api.github.com/users/joakimbeng/received_events","type":"User","site_admin":false},"labels":[{"id":45333493,"node_id":"MDU6TGFiZWw0NTMzMzQ5Mw==","url":"https://api.github.com/repos/OptimalBits/bull/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-28T09:51:51Z","updated_at":"2018-12-13T15:06:43Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nYou may report several types of issues. Bug reports, enhancements or questions.\r\nFor bug reports however you are required to provice some information so that the \r\nissue can be resolved efficiently. The following template should be filled for bugs.\r\n-->\r\n\r\n## Description\r\n\r\nThe problem with unhandled promise rejections do still occur (see #1012).\r\n\r\n## Minimal, Working Test code to reproduce the issue.\r\n\r\nReproduced the issue in a separate repo: https://github.com/joakimbeng/bull-connection-problem\r\n\r\nThe code is essentially this:\r\n\r\n```js\r\n'use strict';\r\nconst Queue = require('bull');\r\n\r\nconst queue = new Queue('my-queue');\r\n\r\nqueue.on('waiting', jobId => console.log('Job waiting', jobId));\r\nqueue.on('error', error => console.error('Queue Error', error));\r\n\r\nqueue.process(job => {\r\n  console.log('processing job', job.id);\r\n});\r\n\r\nqueue.add({some: 'data'});\r\n\r\nprocess.on('unhandledRejection', error => {\r\n  console.error('Unhandled Rejection', error);\r\n  process.exit(1);\r\n});\r\n```\r\n\r\n## Bull version\r\n\r\nv3.5.2\r\n\r\n## Additional information\r\n\r\nThe two function calls that are causing this is the [`this.setWorkerName()`](https://github.com/OptimalBits/bull/blob/master/lib/queue.js#L683) and [`utils.isRedisReady` in `commands/index.js`](https://github.com/OptimalBits/bull/blob/master/lib/commands/index.js#L27). (`utils.isRedisReady` is the function that's actually causing the issue in `this.setWorkerName` as well).\r\n\r\nAlso, the problem only occurs after the `queue.process` function have been called, which the #1012 did not cover.\r\n"},"comment":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/comments/447001237","html_url":"https://github.com/OptimalBits/bull/issues/1141#issuecomment-447001237","issue_url":"https://api.github.com/repos/OptimalBits/bull/issues/1141","id":447001237,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzAwMTIzNw==","user":{"login":"macpatel","id":5616105,"node_id":"MDQ6VXNlcjU2MTYxMDU=","avatar_url":"https://avatars2.githubusercontent.com/u/5616105?v=4","gravatar_id":"","url":"https://api.github.com/users/macpatel","html_url":"https://github.com/macpatel","followers_url":"https://api.github.com/users/macpatel/followers","following_url":"https://api.github.com/users/macpatel/following{/other_user}","gists_url":"https://api.github.com/users/macpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/macpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macpatel/subscriptions","organizations_url":"https://api.github.com/users/macpatel/orgs","repos_url":"https://api.github.com/users/macpatel/repos","events_url":"https://api.github.com/users/macpatel/events{/privacy}","received_events_url":"https://api.github.com/users/macpatel/received_events","type":"User","site_admin":false},"created_at":"2018-12-13T15:06:43Z","updated_at":"2018-12-13T15:06:43Z","author_association":"NONE","body":"This works for me.\r\n```\r\n//process queue \r\nbullQueue.isReady(()=>{\r\n  bullQueue.process( (job='', jobDone) =>{\r\n    console.log('Started Queues.');\r\n    jobDone();\r\n    // await processJobs(job, data);\r\n  });\r\n})\r\n\r\n```"}}
{"actor":{"display_login":"macpatel"}}