@thzero/library_server 0.18.11 → 0.18.12

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/boot/index.js +14 -8
  2. package/package.json +3 -3
package/boot/index.js CHANGED
@@ -2,7 +2,7 @@ import { createTerminus } from '@godaddy/terminus';
2
2
 
3
3
  import config from 'config';
4
4
 
5
- import {internalIpV4} from '@thzero/library_server/utility/internalIp/index.js';
5
+ import { internalIpV4 } from '@thzero/library_server/utility/internalIp/index.js';
6
6
 
7
7
  import LibraryServerConstants from '../constants.js';
8
8
  import LibraryCommonServiceConstants from '@thzero/library_common_service/constants.js';
@@ -91,17 +91,23 @@ class BootMain {
91
91
 
92
92
  const results = await this._initApp(args, plugins);
93
93
 
94
- function onSignal() {
95
- this.loggerServiceI.info2(`server is starting cleanup`);
94
+ async function onSignal() {
95
+ console.log('server is starting cleanup');
96
+ this.loggerServiceI.info2('server is starting cleanup');
96
97
  const cleanupFuncs = [];
97
98
  this._initCleanup(cleanupFuncs);
98
99
  this._initCleanupDiscovery(cleanupFuncs);
99
- return Promise.all(cleanupFuncs);
100
+ await Promise.all(cleanupFuncs);
101
+ console.log('server is starting cleanup completed');
102
+ this.loggerServiceI.info2('server is starting cleanup completed');
100
103
  }
101
104
 
102
- function onShutdown() {
105
+ async function onShutdown() {
106
+ console.log('server is shutting down');
107
+ this.loggerServiceI.info2('server is shutting down');
103
108
  this._initShutdown();
104
- this.loggerServiceI.info2(`cleanup finished, server is shutting down`);
109
+ console.log('server is shutting down completed');
110
+ this.loggerServiceI.info2('server is shutting down completed');
105
111
  }
106
112
 
107
113
  function healthCheck() {
@@ -130,7 +136,7 @@ class BootMain {
130
136
  healthChecks: healthCheckOptions,
131
137
 
132
138
  // cleanup options
133
- signals: [ 'SIGINT', 'SIGTERM' ],
139
+ signals: [ 'SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGKILL' ],
134
140
  onSignal: onSignal.bind(this), // [optional] cleanup function, returning a promise (used to be onSigterm)
135
141
  onShutdown: onShutdown.bind(this) // [optional] called right before exiting
136
142
  };
@@ -200,7 +206,7 @@ class BootMain {
200
206
  self._initAppListen(results.app, results.server, address, port, (err) => {
201
207
  if (err) {
202
208
  reject(err);
203
- return;
209
+ process.exit(1);
204
210
  }
205
211
 
206
212
  resolve();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thzero/library_server",
3
3
  "type": "module",
4
- "version": "0.18.11",
4
+ "version": "0.18.12",
5
5
  "version_major": 0,
6
6
  "version_minor": 18,
7
- "version_patch": 11,
8
- "version_date": "04/23/2024",
7
+ "version_patch": 12,
8
+ "version_date": "05/01/2024",
9
9
  "description": "An opinionated library of common functionality to bootstrap an API using either Fastify or Koa as the web server.",
10
10
  "author": "thZero",
11
11
  "license": "MIT",