@adaptivestone/framework 5.0.0-beta.3 → 5.0.0-beta.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 5.0.0-beta.4
2
+
3
+ [NEW] on shutdown event now after timeout we are forcing to shutdown
4
+
1
5
  ### 5.0.0-beta.2
2
6
 
3
7
  [UPDATE] update deps
@@ -23,7 +23,7 @@ class AbstractCommand extends Base {
23
23
  * @returns string
24
24
  */
25
25
  static getMongoConnectionName(commandName, args) {
26
- return `CLI: ${commandName} ${args.join(' ')}`;
26
+ return `CLI: ${commandName} ${JSON.stringify(args)}`;
27
27
  }
28
28
 
29
29
  /**
@@ -49,6 +49,10 @@ class AbstractModel extends Base {
49
49
  this.logger.info(
50
50
  `Mongo connection success ${connectionParams.appName}`,
51
51
  );
52
+ mongoose.connection.on('error', (err) => {
53
+ this.logger.error('Mongo connection error', err);
54
+ console.error(err);
55
+ });
52
56
 
53
57
  callback();
54
58
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptivestone/framework",
3
- "version": "5.0.0-beta.3",
3
+ "version": "5.0.0-beta.4",
4
4
  "description": "Adaptive stone node js framework",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/server.js CHANGED
@@ -66,6 +66,15 @@ class Server {
66
66
  models: new Map(),
67
67
  modelConstructors: new Map(),
68
68
  };
69
+
70
+ this.app.events.on('shutdown', () => {
71
+ const forceShutdownTimer = setTimeout(() => {
72
+ console.error('Shutdown timed out, forcing exit');
73
+ process.exit(1);
74
+ }, 5_000);
75
+ // Unref the timer so it doesn't keep the process alive
76
+ forceShutdownTimer.unref();
77
+ });
69
78
  }
70
79
 
71
80
  /**