{"action":"created","issue":{"url":"https://api.github.com/repos/kelektiv/node-uuid/issues/150","repository_url":"https://api.github.com/repos/kelektiv/node-uuid","labels_url":"https://api.github.com/repos/kelektiv/node-uuid/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/kelektiv/node-uuid/issues/150/comments","events_url":"https://api.github.com/repos/kelektiv/node-uuid/issues/150/events","html_url":"https://github.com/kelektiv/node-uuid/issues/150","id":187596479,"number":150,"title":"Should be possible to use `crypto.randomBytes`'s async API","user":{"login":"brendanlong","id":1447206,"avatar_url":"https://avatars.githubusercontent.com/u/1447206?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanlong","html_url":"https://github.com/brendanlong","followers_url":"https://api.github.com/users/brendanlong/followers","following_url":"https://api.github.com/users/brendanlong/following{/other_user}","gists_url":"https://api.github.com/users/brendanlong/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanlong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanlong/subscriptions","organizations_url":"https://api.github.com/users/brendanlong/orgs","repos_url":"https://api.github.com/users/brendanlong/repos","events_url":"https://api.github.com/users/brendanlong/events{/privacy}","received_events_url":"https://api.github.com/users/brendanlong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-06T22:58:58Z","updated_at":"2016-11-17T18:43:36Z","closed_at":null,"body":"Running my program with `--trace-sync-io`, I see:\r\n\r\n    WARNING: Detected use of sync API\r\n    at _rng (/home/blong/trello-idea-powerup/node_modules/node-uuid/uuid.js:60:53)\r\n    at v4 (/home/blong/trello-idea-powerup/node_modules/node-uuid/uuid.js:224:55)\r\n    // etc.\r\n\r\nThe problem is that you're using [`crypto.randomBytes`](https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback) synchronously, and don't seem to provide a way to pass a callback and use the async API."},"comment":{"url":"https://api.github.com/repos/kelektiv/node-uuid/issues/comments/261331955","html_url":"https://github.com/kelektiv/node-uuid/issues/150#issuecomment-261331955","issue_url":"https://api.github.com/repos/kelektiv/node-uuid/issues/150","id":261331955,"user":{"login":"randunel","id":1965181,"avatar_url":"https://avatars.githubusercontent.com/u/1965181?v=3","gravatar_id":"","url":"https://api.github.com/users/randunel","html_url":"https://github.com/randunel","followers_url":"https://api.github.com/users/randunel/followers","following_url":"https://api.github.com/users/randunel/following{/other_user}","gists_url":"https://api.github.com/users/randunel/gists{/gist_id}","starred_url":"https://api.github.com/users/randunel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randunel/subscriptions","organizations_url":"https://api.github.com/users/randunel/orgs","repos_url":"https://api.github.com/users/randunel/repos","events_url":"https://api.github.com/users/randunel/events{/privacy}","received_events_url":"https://api.github.com/users/randunel/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T18:43:36Z","updated_at":"2016-11-17T18:43:36Z","body":"@broofa same test on my PC, which is considerably more powerful than the virtual machines production software runs on:\r\n\r\n```\r\nmihai / /tmp/random-bytes \r\n--€ cat asyncRandomBytes.js \r\ncrypto = require(\"crypto\");\r\nfor (var i = 0; i < 200000; i++) {\r\n  crypto.randomBytes(256, function(err) {});\r\n}\r\nmihai / /tmp/random-bytes \r\n--€ time node asyncRandomBytes.js \r\n\r\nreal\t0m0.690s\r\nuser\t0m2.796s\r\nsys\t0m0.260s\r\nmihai / /tmp/random-bytes \r\n--€ cat syncRandomBytes.js \r\ncrypto = require(\"crypto\");\r\nfor (var i = 0; i < 200000; i++) {\r\n  crypto.randomBytes(256);\r\n}\r\nmihai / /tmp/random-bytes \r\n--€ time node syncRandomBytes.js \r\n\r\nreal\t0m1.852s\r\nuser\t0m1.836s\r\nsys\t0m0.012s\r\n```\r\n\r\nI would be surprised to find any companies running their servers on macbook pros. The same argument \"meh, it's fast enough on my pc\" can be used for `fs.readFileSync` because many macbook pros have SSDs, right?"}}
{"actor":{"display_login":"randunel"}}