srvx-nightly 0.10.1-20260117-120118-584cc46 → 0.10.1-20260117-200546-7f593b7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/_plugins.mjs +12 -2
- package/dist/adapters/node.mjs +0 -1
- package/package.json +1 -1
|
@@ -31,16 +31,26 @@ const gracefulShutdownPlugin = (server) => {
|
|
|
31
31
|
const gracefulShutdown = config === true || !config?.gracefulTimeout ? Number.parseInt(process.env.SERVER_SHUTDOWN_TIMEOUT || "") || 3 : config.gracefulTimeout;
|
|
32
32
|
const forceShutdown = config === true || !config?.forceTimeout ? Number.parseInt(process.env.SERVER_FORCE_SHUTDOWN_TIMEOUT || "") || 5 : config.forceTimeout;
|
|
33
33
|
let isShuttingDown = false;
|
|
34
|
+
let forceClose;
|
|
34
35
|
const shutdown = async () => {
|
|
35
|
-
if (isShuttingDown)
|
|
36
|
+
if (isShuttingDown) {
|
|
37
|
+
forceClose?.();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
36
40
|
isShuttingDown = true;
|
|
37
41
|
const w = process.stderr.write.bind(process.stderr);
|
|
38
|
-
w(gray(`\nShutting down server in ${gracefulShutdown}s
|
|
42
|
+
w(gray(`\nShutting down server in ${gracefulShutdown}s... (press Ctrl+C again to force close)`));
|
|
39
43
|
let timeout;
|
|
40
44
|
await Promise.race([server.close().finally(() => {
|
|
41
45
|
clearTimeout(timeout);
|
|
42
46
|
w(gray(" Server closed.\n"));
|
|
43
47
|
}), new Promise((resolve) => {
|
|
48
|
+
forceClose = () => {
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
w(gray("\nForce closing...\n"));
|
|
51
|
+
server.close(true);
|
|
52
|
+
resolve();
|
|
53
|
+
};
|
|
44
54
|
timeout = setTimeout(() => {
|
|
45
55
|
w(gray(`\nForce closing connections in ${forceShutdown}s...`));
|
|
46
56
|
timeout = setTimeout(() => {
|
package/dist/adapters/node.mjs
CHANGED
|
@@ -210,7 +210,6 @@ const NodeRequest = /* @__PURE__ */ (() => {
|
|
|
210
210
|
const { req, res } = this.runtime.node;
|
|
211
211
|
const abortController = this.#abortController;
|
|
212
212
|
const abort = (err) => abortController.abort?.(err);
|
|
213
|
-
req.once("error", abort);
|
|
214
213
|
if (res) res.once("close", () => {
|
|
215
214
|
const reqError = req.errored;
|
|
216
215
|
if (reqError) abort(reqError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "srvx-nightly",
|
|
3
|
-
"version": "0.10.1-20260117-
|
|
3
|
+
"version": "0.10.1-20260117-200546-7f593b7",
|
|
4
4
|
"description": "Universal Server API based on web platform standards. Works seamlessly with Deno, Bun and Node.js.",
|
|
5
5
|
"homepage": "https://srvx.h3.dev",
|
|
6
6
|
"repository": "h3js/srvx",
|