Skip to content

doc: clarify sub-1000ms behavior in socket.setKeepAlive - #65869

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
haramj:doc-setkeepalive-sub1000
Sep 18, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
haramj:doc-setkeepalive-sub1000

Conversation

@haramj

@haramj haramj commented Sep 7, 2026

Copy link
Copy Markdown
Member

Description

The current documentation states that initialDelay and interval are divided by 1000 and rounded down, but does not explicitly mention that values less than 1000ms will result in 0 seconds. This can lead to confusion when users pass values like 400ms expecting sub-second keepalive delays.

This PR adds a concrete example showing that 400ms rounds down to 0 seconds.

Example

socket.setKeepAlive(true, 400);
// TCP_KEEPIDLE becomes 0 seconds (400 / 1000 rounds down to 0)

Refs

Checklist

  • Documentation is changed or added
  • Commit message follows commit guidelines

The current documentation states that `initialDelay` and `interval`
are divided by 1000 and rounded down, but does not explicitly mention
that values less than 1000ms will result in 0 seconds. This can lead
to confusion when users pass values like 400ms expecting sub-second
keepalive delays.

Add a concrete example showing that 400ms rounds down to 0 seconds.

Refs: nodejs#57712

Signed-off-by: haramjeong <04harams77@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. net Issues and PRs related to the net subsystem. labels Sep 7, 2026
@haramj

haramj commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

Hi! This PR has been approved and all checks are passing. Would anyone from @nodejs/net be able to take another look when you have a chance? Please let me know if any further changes are needed. Thanks!

@panva panva added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 14, 2026
@inoway46 inoway46 added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 18, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 7c01b98 into nodejs:main Sep 18, 2026
33 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 7c01b98

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 18, 2026
aduh95 pushed a commit that referenced this pull request Sep 18, 2026
The current documentation states that `initialDelay` and `interval`
are divided by 1000 and rounded down, but does not explicitly mention
that values less than 1000ms will result in 0 seconds. This can lead
to confusion when users pass values like 400ms expecting sub-second
keepalive delays.

Add a concrete example showing that 400ms rounds down to 0 seconds.

Refs: #57712

Signed-off-by: haramjeong <04harams77@gmail.com>
PR-URL: #65869
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. doc Issues and PRs related to Node.js documentation. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants