Skip to content

cluster: update deprecated API - #13704

Closed
jasnell wants to merge 3 commits into
nodejs:v8.x-stagingfrom
jasnell:update-deprecated-api
Closed

cluster: update deprecated API#13704
jasnell wants to merge 3 commits into
nodejs:v8.x-stagingfrom
jasnell:update-deprecated-api

Conversation

@jasnell

Copy link
Copy Markdown
Member

This goes along with #13702 and is part of the alternative for #13684

Mark the deprecated API non-enumerable, remove from docs, and update the deprecation message.
Technically, marking an API non-enumerable would be semver-major, but I'm proposing this as a semver-patch. The deprecated API is still there, existing code should not break as it's extremely unlikely that existing uses of the API are depending on it being enumerable.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

cluster

@jasnelljasnell added the cluster Issues and PRs related to the cluster subsystem. label Jun 15, 2017
@jasnelljasnell mentioned this pull request Jun 15, 2017
4 tasks
@refack

Copy link
Copy Markdown
Contributor

If this gets push back, #13703 could be considered, as it's even less major.

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cjihrigcjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although the deprecation message may confuse people at first glance just because it doesn't say what they should be using exitedAfterDisconnect in place of (I get that is the point though).

@MylesBorinsMylesBorins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if Ci is green

Comment threaddoc/api/deprecations.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider removing the phrase from the error code?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I think it's necessary for context, otherwise those seeing the deprecation error and not having any context won't really have a clue what it is about, or any ability to find out. The whole reason deprecations.md exists is to provide that context when necessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be a reference though right? like give you a url to check the extended documentation?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the extended documentation. This message is in deprecations.md, this is not the warning message that is printed to the console.

@ChALkeR

Copy link
Copy Markdown
Member

@jasnell I can't think of any noticeable negative consequnces of this spefic PR, but I am not fully convinced that the property should be entirely removed in 9.0 yet.

Comment threadlib/internal/cluster/worker.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure yet that the correct action would be to remove the property entirely in 9.0.
Apart from this comment, this change looks fine.

Comment threaddoc/api/deprecations.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: an unfortunate decision was made to add a boolean property with the name -> there was a boolean property named

unfortunate appears a couple sentences later so we can remove the repetition of the word here without losing content

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can update that in whichever one of the PRs is landed first then cherry-pick the updated commit here.

Comment threadlib/internal/cluster/worker.js Outdated

@seishunseishunJun 15, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause people to see warnings like (node:4680) DeprecationWarning: Please use worker.exitedAfterDisconnect instead., which is completely uninformative.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, and in general I agree that it's not ideal, but this is about finding a compromise that avoids the original problem. The reason deprecation codes were added is to provide a mechanism for finding the context if necessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone sees the warning and decides to find the context, they'll see the word anyway. The only case where hiding it here would help is when the warning is perpetually ignored.

@refackrefackJun 17, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be (node:4680) [DEP0007] DeprecationWarning: Please use worker.exitedAfterDisconnect instead. and that easily googleable.
We can't eliminate all references, but putting it one step further is good IMHO.
(at least it won't be repeated over and over in the logs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard for me to imagine a scenario where it would be repeated over and over in the logs, as the warning is one-time per process.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the paradox of this whole situation... see (content warning) Unitech/pm2#2780

@jasnell
jasnellforce-pushed the update-deprecated-api branch 2 times, most recently from f05dbdf to 8a0f530CompareJune 15, 2017 21:29
@jasnell

Copy link
Copy Markdown
MemberAuthor

Updated the deprecations.md text to use the wording suggested by @Trotthere

@jasnell

Copy link
Copy Markdown
MemberAuthor

ping @nodejs/ctc
Given the sign off, I'd like to get this landed by tomorrow, but want to make sure there are no objections

@jasnell
jasnellforce-pushed the update-deprecated-api branch from 8a0f530 to 704428eCompareJune 20, 2017 16:03
@jasnell
jasnellforce-pushed the update-deprecated-api branch from 704428e to 6f73f4fCompareJune 20, 2017 16:09
@jasnell

Copy link
Copy Markdown
MemberAuthor

Updated the language in the docs a bit.

@jasnell

Copy link
Copy Markdown
MemberAuthor

@jasnell

Copy link
Copy Markdown
MemberAuthor

CI failure is unrelated.

jasnell added a commit that referenced this pull request Jun 20, 2017
PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
jasnell added a commit that referenced this pull request Jun 20, 2017
PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
jasnell added a commit that referenced this pull request Jun 20, 2017
Make deprecated property non-enumerable, remove from docs
PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 3d2b59f, 7007f70, and f64ea03

@jasnelljasnell closed this Jun 20, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clusterIssues and PRs related to the cluster subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@jasnell@refack@ChALkeR@mcollina@MylesBorins@Trott@addaleax@seishun@cjihrig@nodejs-github-bot