New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate variadic listen method (closes #3652) #3712
Conversation
9770bbf
to
5fab6f0
Compare
On one hand it makes totally a good point to do it this way, on the other this is a slight change of common use from the javascript ecosystem; this will potentially raise Developer questions. I'm +1 on this approach. |
Regarding the callback: let's keep it as a separate argument. I'm not really convinced that we ready for a deprecation cycle warning on this. I fear that the churn for our users and the uproar on our repo would be too high. However I support the change to a single object everywhere including our docs. How about:
Node has a --pending-deprecation, we might look into hooking into the same logic. |
Can't we make the same argument for every release?
Are we planning for a more aggressive release cycle? I think we should try to track core's LTS cycle.
This is the first I am learning about this flag. I bet not many outside of core know about it. |
I would target a one-release-per-year cycle. v4 has been dragging way too long. |
Agreed. That timeline matches with tracking core LTS. Which means we would end up maintaining this code block for two more years instead of one. What other churn in v4 are we saying will cause this one to be too much? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code: LGMT but this PR requires a follow-up PR for documentation.
I would release it in v4 after updating the docs as well.
What follow up for docs? All docs are updated in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think is missing to update:
- The examples folder - e.g: https://github.com/fastify/fastify/blob/main/examples/simple.js#L28
- The type definition of
.listen
- The documentation/guides - e.g: https://github.com/fastify/fastify/blob/2b6974a39905ce654d9fbf85165e68e2cd230a6c/docs/Guides/Getting-Started.md#your-first-server
I see only I mean the README for example, that uses the |
A push got missed. Probably forgot to use |
b617acb
to
4d49ced
Compare
Readme and examples have been updated.
@mcollina can you address this question? |
After my zoom conference (it should end in less than one hour) I will submit one with all these options and a proper deprecation message ^^ |
It should target the branch of this PR. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
||
```js | ||
fastify.listen({ port: 3000, host: '127.0.0.1', backlog: 511 }, (err) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the backlog parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying it no longer matches with the lead-in text.
Co-authored-by: darkgl0w <31093081+darkgl0w@users.noreply.github.com>
The PR adding typescript definitions for this change is ready to be reviewed here. While digging in the code to write the types a few points raised my attention :
|
No.
Same bug.
No. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm,
could you add this to the release notes (google docs) too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jsumners what link? |
The Google doc. @RafaelGSS got it to me. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Resolves #3652.
As I am going through the process of getting this PR together, I am more convinced that this is the right path. I have had to jump through several hoops to cover cases of "was this signature provided? That one? This one?", and deal with adding/removing coverage from tests. Once we get past the deprecation phase, the listen code will be simplified by virtue of completely removing that
normalizeListenArgs
function and the ceremony around feeding it.Technically, as implemented, the signature is still variadic since it accepts a second, optional, parameter for the callback. Should we require the callback in the options object? This would be slightly odd in that it isn't a typical pattern. But we already internally support (and actually require)
listenOptions.cb
be defined when a callback is to be used.Checklist
npm run test
andnpm run benchmark
and the Code of conduct