weifuwu 0.16.5 → 0.16.6

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -123,12 +123,15 @@ function serve(handler, options) {
123
123
  resolveReady = r;
124
124
  });
125
125
  if (options?.shutdown !== false) {
126
- process.on("SIGTERM", () => {
126
+ let shuttingDown = false;
127
+ const shutdown = () => {
128
+ if (shuttingDown) return;
129
+ shuttingDown = true;
127
130
  server.close();
128
- });
129
- process.on("SIGINT", () => {
130
- server.close();
131
- });
131
+ process.exit(0);
132
+ };
133
+ process.on("SIGTERM", shutdown);
134
+ process.on("SIGINT", shutdown);
132
135
  }
133
136
  if (options?.signal) {
134
137
  if (options.signal.aborted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weifuwu",
3
- "version": "0.16.5",
3
+ "version": "0.16.6",
4
4
  "description": "Web-standard HTTP framework for Node.js — (req, ctx) => Response",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",