Skip to content

feat: document shutdown config option for @astrojs/node - #14535

Open
WhatCats wants to merge 1 commit into
withastro:mainfrom
WhatCats:docs/node-shutdown-option
Open

WhatCats wants to merge 1 commit into
withastro:mainfrom
WhatCats:docs/node-shutdown-option

Conversation

@WhatCats

Copy link
Copy Markdown

Description

Documents the new shutdown config option for the Node adapter, which controls graceful shutdown behavior (timeout and exit) when the standalone server receives SIGTERM/SIGINT.

References

@astrobot-houston

Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🥳.

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@astrobot-houston

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/integrations-guide/node.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown

Preview deployment

✅ Deployment complete!

@ArmandPhilippot ArmandPhilippot 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.

Thanks @WhatCats, and welcome! I’ve left a few suggestions to make the section consistent with how we document APIs and how we write.


<p>
**Type:** `{ timeout?: number; exit?: boolean }` <br />
**Default:** `{ timeout: 10000, exit: false }` (10 second timeout, process exits naturally)<br />

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.

Unless the value can be hard to understand (e.g. bodySizeLimit), we usually don't had parentheses: the description is here to explain the values.

Suggested change
**Default:** `{ timeout: 10000, exit: false }` (10 second timeout, process exits naturally)<br />
**Default:** `{ timeout: 10000, exit: false }`<br />

<Since pkg="@astrojs/node" v="11.2.0" />
</p>

Controls graceful shutdown of the [`standalone`](#mode) server when it receives a `SIGTERM` or `SIGINT` signal (for example, when your host stops or restarts the process). The server stops accepting new connections but waits for in-flight requests to finish before closing.

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.

We use e.g. for the example in parentheses and we prefer simpler vocabulary. I feel "in-flight" might not be explicit enough for non-native speakers or less technical people. I'm not sure what would be the most accurate ("active"/"current"/"ongoing"), feel free to correct my suggestion.

Suggested change
Controls graceful shutdown of the [`standalone`](#mode) server when it receives a `SIGTERM` or `SIGINT` signal (for example, when your host stops or restarts the process). The server stops accepting new connections but waits for in-flight requests to finish before closing.
Controls graceful shutdown behavior of the [`standalone`](#mode) server when it receives a `SIGTERM` or `SIGINT` signal (e.g. when a host stops or restarts the process). The server stops accepting new connections but waits for active requests to finish before closing.

Comment on lines +198 to +201
Configure the following:

* **`timeout`** controls how long, in milliseconds, to wait for in-flight requests to finish before force-closing any remaining connections. Set to `0` to force-close immediately, or `Infinity` to wait indefinitely for in-flight requests to finish.
* **`exit`** controls whether to call `process.exit()` once shutdown completes. By default, the adapter lets the process exit naturally once the event loop is empty, so any other `SIGTERM`/`SIGINT` listeners your app has registered (for example, to close a database connection) get a chance to finish first. Enable this only if you want a guaranteed exit even when something else in the process (a timer, an open connection) would otherwise keep it running.

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.

We use subheadings to document nested properties and we introduce code snippets with a sentence:

Suggested change
Configure the following:
* **`timeout`** controls how long, in milliseconds, to wait for in-flight requests to finish before force-closing any remaining connections. Set to `0` to force-close immediately, or `Infinity` to wait indefinitely for in-flight requests to finish.
* **`exit`** controls whether to call `process.exit()` once shutdown completes. By default, the adapter lets the process exit naturally once the event loop is empty, so any other `SIGTERM`/`SIGINT` listeners your app has registered (for example, to close a database connection) get a chance to finish first. Enable this only if you want a guaranteed exit even when something else in the process (a timer, an open connection) would otherwise keep it running.
The following example configures a 30-second shutdown timeout and forces the process to exit once the shutdown is complete:

}),
});
```

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 moved your the nested properties description to their own subheadings. And I tried to tighten a bit the wording to be more direct. Feel free to tell if any important information is missing.

Suggested change
#### `shutdown.timeout`
<p>
**Type:** `number`<br />
**Default:** `10000`
</p>
The duration in milliseconds to wait for active requests to finish before force-closing remaining connections. Set to `0` to force-close immediately, or `Infinity` to wait indefinitely.
#### `shutdown.exit`
<p>
**Type:** `boolean`<br />
**Default:** `false`
</p>
Controls whether to call `process.exit()` once shutdown completes. By default, the process exits naturally when the event loop is empty, allowing other signal listeners (e.g. database disconnect handlers) to finish first. Set to `true` to force the process to exit even if open timers or connections remain.

@ArmandPhilippot ArmandPhilippot added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants