@midwayjs/bootstrap 4.0.0-beta.10 → 4.0.0-beta.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.
@@ -19,6 +19,7 @@ export declare class Bootstrap {
19
19
  protected static logger: ILogger;
20
20
  protected static configured: boolean;
21
21
  protected static bootstrapLoggerFactory: LoggerFactory;
22
+ protected static runningPromise: Promise<IMidwayGlobalContainer> | null;
22
23
  /**
23
24
  * set global configuration for midway
24
25
  * @param configuration
package/dist/bootstrap.js CHANGED
@@ -92,6 +92,7 @@ class Bootstrap {
92
92
  static logger;
93
93
  static configured = false;
94
94
  static bootstrapLoggerFactory = new logger_1.LoggerFactory();
95
+ static runningPromise = null;
95
96
  /**
96
97
  * set global configuration for midway
97
98
  * @param configuration
@@ -133,6 +134,9 @@ class Bootstrap {
133
134
  return this.starter;
134
135
  }
135
136
  static async run() {
137
+ if (this.runningPromise) {
138
+ return this.runningPromise;
139
+ }
136
140
  if (!this.configured) {
137
141
  this.configure();
138
142
  }
@@ -149,7 +153,7 @@ class Bootstrap {
149
153
  process.on('uncaughtException', this.uncaughtExceptionHandler);
150
154
  this.unhandledRejectionHandler = this.unhandledRejectionHandler.bind(this);
151
155
  process.on('unhandledRejection', this.unhandledRejectionHandler);
152
- return this.getStarter()
156
+ this.runningPromise = this.getStarter()
153
157
  .run()
154
158
  .then(() => {
155
159
  this.logger.info('[midway:bootstrap] current app started');
@@ -160,6 +164,7 @@ class Bootstrap {
160
164
  this.logger.error(err);
161
165
  process.exit(1);
162
166
  });
167
+ return this.runningPromise;
163
168
  }
164
169
  static async stop() {
165
170
  await this.getStarter().stop();
@@ -171,6 +176,7 @@ class Bootstrap {
171
176
  static reset() {
172
177
  this.configured = false;
173
178
  this.starter = null;
179
+ this.runningPromise = null;
174
180
  this.bootstrapLoggerFactory.close();
175
181
  }
176
182
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/bootstrap",
3
- "version": "4.0.0-beta.10",
3
+ "version": "4.0.0-beta.12",
4
4
  "description": "midwayjs bootstrap",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@midwayjs/event-bus": "1.11.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@midwayjs/core": "^4.0.0-beta.10",
27
+ "@midwayjs/core": "^4.0.0-beta.12",
28
28
  "@midwayjs/logger": "^4.0.0",
29
29
  "request": "2.88.2",
30
30
  "socket.io-client": "4.8.1"
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=20"
39
39
  },
40
- "gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
40
+ "gitHead": "1c48179b7c827ba8ec9351e9b6c36ec1726d3e11"
41
41
  }