{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/240391367","pull_request_review_id":183412630,"id":240391367,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDM5MTM2Nw==","diff_hunk":"@@ -520,23 +529,37 @@ function needFinish(state) {\n           !state.finished &&\n           !state.writing);\n }\n-\n-function prefinish(stream, state) {\n-  if (!state.prefinished) {\n+function callFinal(stream, state) {\n+  stream._final((err) => {\n+    state.pendingcb--;\n+    if (err) {\n+      stream.emit('error', err);\n+    }\n     state.prefinished = true;\n     stream.emit('prefinish');\n+    finishMaybe(stream, state);\n+  });\n+}\n+function prefinish(stream, state) {\n+  if (!state.prefinished && !state.finalCalled) {\n+    if (typeof stream._final === 'function') {\n+      state.pendingcb++;\n+      state.finalCalled = true;\n+      process.nextTick(callFinal, stream, state);","path":"lib/_stream_writable.js","position":46,"original_position":46,"commit_id":"c1d5cd0345fbeaafd23ddaae68fb48912d97e35a","original_commit_id":"c1d5cd0345fbeaafd23ddaae68fb48912d97e35a","user":{"login":"szmarczak","id":36894700,"node_id":"MDQ6VXNlcjM2ODk0NzAw","avatar_url":"https://avatars0.githubusercontent.com/u/36894700?v=4","gravatar_id":"","url":"https://api.github.com/users/szmarczak","html_url":"https://github.com/szmarczak","followers_url":"https://api.github.com/users/szmarczak/followers","following_url":"https://api.github.com/users/szmarczak/following{/other_user}","gists_url":"https://api.github.com/users/szmarczak/gists{/gist_id}","starred_url":"https://api.github.com/users/szmarczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szmarczak/subscriptions","organizations_url":"https://api.github.com/users/szmarczak/orgs","repos_url":"https://api.github.com/users/szmarczak/repos","events_url":"https://api.github.com/users/szmarczak/events{/privacy}","received_events_url":"https://api.github.com/users/szmarczak/received_events","type":"User","site_admin":false},"body":"Hmm... Is `process.nextTick` really needed here? Can someone confirm/deny?","created_at":"2018-12-10T21:42:17Z","updated_at":"2018-12-10T21:42:18Z","html_url":"https://github.com/nodejs/node/pull/12828#discussion_r240391367","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/12828","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/240391367"},"html":{"href":"https://github.com/nodejs/node/pull/12828#discussion_r240391367"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/12828"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/12828","id":118986915,"node_id":"MDExOlB1bGxSZXF1ZXN0MTE4OTg2OTE1","html_url":"https://github.com/nodejs/node/pull/12828","diff_url":"https://github.com/nodejs/node/pull/12828.diff","patch_url":"https://github.com/nodejs/node/pull/12828.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/12828","number":12828,"state":"closed","locked":false,"title":"stream: add final method","user":{"login":"calvinmetcalf","id":1128607,"node_id":"MDQ6VXNlcjExMjg2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1128607?v=4","gravatar_id":"","url":"https://api.github.com/users/calvinmetcalf","html_url":"https://github.com/calvinmetcalf","followers_url":"https://api.github.com/users/calvinmetcalf/followers","following_url":"https://api.github.com/users/calvinmetcalf/following{/other_user}","gists_url":"https://api.github.com/users/calvinmetcalf/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinmetcalf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinmetcalf/subscriptions","organizations_url":"https://api.github.com/users/calvinmetcalf/orgs","repos_url":"https://api.github.com/users/calvinmetcalf/repos","events_url":"https://api.github.com/users/calvinmetcalf/events{/privacy}","received_events_url":"https://api.github.com/users/calvinmetcalf/received_events","type":"User","site_admin":false},"body":"Adds the ability to for write streams to have an _final method which acts\r\nsimilarly to the _flush method that transform streams have but is called before\r\nthe finish event is emitted and if asynchronous delays the stream from\r\nfinishing.  The `final` option may also be passed in order to set it.\r\n\r\nthis is a new version of #2314 as discussed at nodejs/readable-stream#275, cc @nodejs/streams \r\n\r\n<!--\r\nThank you for your pull request. Please provide a description above and review\r\nthe requirements below.\r\n\r\nBug fixes and new features should include tests and possibly benchmarks.\r\n\r\nContributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [x] tests and/or benchmarks are included\r\n- [x] documentation is changed or added\r\n- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#commit-guidelines)\r\n\r\n##### Affected core subsystem(s)\r\n<!-- Provide affected core subsystem(s) (like doc, cluster, crypto, etc). -->\r\n","created_at":"2017-05-04T14:29:32Z","updated_at":"2018-12-10T21:42:18Z","closed_at":"2017-05-24T17:21:10Z","merged_at":null,"merge_commit_sha":"d2113a8230ae1b971b3d8ada56a58665f03e7469","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":169485478,"node_id":"MDU6TGFiZWwxNjk0ODU0Nzg=","url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0","default":false},{"id":155435883,"node_id":"MDU6TGFiZWwxNTU0MzU4ODM=","url":"https://api.github.com/repos/nodejs/node/labels/stream","name":"stream","color":"c7def8","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/12828/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/12828/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/12828/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/c1d5cd0345fbeaafd23ddaae68fb48912d97e35a","head":{"label":"calvinmetcalf:streams-final","ref":"streams-final","sha":"c1d5cd0345fbeaafd23ddaae68fb48912d97e35a","user":{"login":"calvinmetcalf","id":1128607,"node_id":"MDQ6VXNlcjExMjg2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1128607?v=4","gravatar_id":"","url":"https://api.github.com/users/calvinmetcalf","html_url":"https://github.com/calvinmetcalf","followers_url":"https://api.github.com/users/calvinmetcalf/followers","following_url":"https://api.github.com/users/calvinmetcalf/following{/other_user}","gists_url":"https://api.github.com/users/calvinmetcalf/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinmetcalf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinmetcalf/subscriptions","organizations_url":"https://api.github.com/users/calvinmetcalf/orgs","repos_url":"https://api.github.com/users/calvinmetcalf/repos","events_url":"https://api.github.com/users/calvinmetcalf/events{/privacy}","received_events_url":"https://api.github.com/users/calvinmetcalf/received_events","type":"User","site_admin":false},"repo":{"id":29616913,"node_id":"MDEwOlJlcG9zaXRvcnkyOTYxNjkxMw==","name":"io.js","full_name":"calvinmetcalf/io.js","private":false,"owner":{"login":"calvinmetcalf","id":1128607,"node_id":"MDQ6VXNlcjExMjg2MDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1128607?v=4","gravatar_id":"","url":"https://api.github.com/users/calvinmetcalf","html_url":"https://github.com/calvinmetcalf","followers_url":"https://api.github.com/users/calvinmetcalf/followers","following_url":"https://api.github.com/users/calvinmetcalf/following{/other_user}","gists_url":"https://api.github.com/users/calvinmetcalf/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinmetcalf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinmetcalf/subscriptions","organizations_url":"https://api.github.com/users/calvinmetcalf/orgs","repos_url":"https://api.github.com/users/calvinmetcalf/repos","events_url":"https://api.github.com/users/calvinmetcalf/events{/privacy}","received_events_url":"https://api.github.com/users/calvinmetcalf/received_events","type":"User","site_admin":false},"html_url":"https://github.com/calvinmetcalf/io.js","description":"A spork of Node.js with an open governance model","fork":true,"url":"https://api.github.com/repos/calvinmetcalf/io.js","forks_url":"https://api.github.com/repos/calvinmetcalf/io.js/forks","keys_url":"https://api.github.com/repos/calvinmetcalf/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/calvinmetcalf/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/calvinmetcalf/io.js/teams","hooks_url":"https://api.github.com/repos/calvinmetcalf/io.js/hooks","issue_events_url":"https://api.github.com/repos/calvinmetcalf/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/calvinmetcalf/io.js/events","assignees_url":"https://api.github.com/repos/calvinmetcalf/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/calvinmetcalf/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/calvinmetcalf/io.js/tags","blobs_url":"https://api.github.com/repos/calvinmetcalf/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/calvinmetcalf/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/calvinmetcalf/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/calvinmetcalf/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/calvinmetcalf/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/calvinmetcalf/io.js/languages","stargazers_url":"https://api.github.com/repos/calvinmetcalf/io.js/stargazers","contributors_url":"https://api.github.com/repos/calvinmetcalf/io.js/contributors","subscribers_url":"https://api.github.com/repos/calvinmetcalf/io.js/subscribers","subscription_url":"https://api.github.com/repos/calvinmetcalf/io.js/subscription","commits_url":"https://api.github.com/repos/calvinmetcalf/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/calvinmetcalf/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/calvinmetcalf/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/calvinmetcalf/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/calvinmetcalf/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/calvinmetcalf/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/calvinmetcalf/io.js/merges","archive_url":"https://api.github.com/repos/calvinmetcalf/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/calvinmetcalf/io.js/downloads","issues_url":"https://api.github.com/repos/calvinmetcalf/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/calvinmetcalf/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/calvinmetcalf/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/calvinmetcalf/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/calvinmetcalf/io.js/labels{/name}","releases_url":"https://api.github.com/repos/calvinmetcalf/io.js/releases{/id}","deployments_url":"https://api.github.com/repos/calvinmetcalf/io.js/deployments","created_at":"2015-01-21T21:31:26Z","updated_at":"2015-01-21T21:31:29Z","pushed_at":"2018-02-17T16:01:41Z","git_url":"git://github.com/calvinmetcalf/io.js.git","ssh_url":"git@github.com:calvinmetcalf/io.js.git","clone_url":"https://github.com/calvinmetcalf/io.js.git","svn_url":"https://github.com/calvinmetcalf/io.js","homepage":"https://iojs.org","size":304288,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"v1.x"}},"base":{"label":"nodejs:master","ref":"master","sha":"06f62eb384f4f823bd224165c224da08d7dec0ab","user":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"node_id":"MDEwOlJlcG9zaXRvcnkyNzE5Mzc3OQ==","name":"node","full_name":"nodejs/node","private":false,"owner":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2018-12-10T18:24:32Z","pushed_at":"2018-12-10T21:39:44Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":440945,"stargazers_count":56266,"watchers_count":56266,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12411,"mirror_url":null,"archived":false,"open_issues_count":727,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":12411,"open_issues":727,"watchers":56266,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/12828"},"html":{"href":"https://github.com/nodejs/node/pull/12828"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/12828"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/12828/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/12828/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/12828/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/c1d5cd0345fbeaafd23ddaae68fb48912d97e35a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"szmarczak"}}