@midwayjs/bootstrap 4.0.0-beta.1 → 4.0.0-beta.10
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/README.md +1 -1
- package/dist/bootstrap.js +10 -5
- package/dist/interface.d.ts +0 -3
- package/dist/manager/base.js +10 -7
- package/dist/manager/cp.d.ts +0 -1
- package/dist/manager/cp.js +1 -0
- package/dist/manager/thread.d.ts +0 -1
- package/dist/manager/thread.js +2 -0
- package/dist/sticky.js +2 -3
- package/dist/util.js +2 -3
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/bootstrap.js
CHANGED
|
@@ -7,9 +7,12 @@ const logger_1 = require("@midwayjs/logger");
|
|
|
7
7
|
const event_bus_1 = require("@midwayjs/event-bus");
|
|
8
8
|
const sticky_1 = require("./sticky");
|
|
9
9
|
class BootstrapStarter {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
10
|
+
appDir;
|
|
11
|
+
baseDir;
|
|
12
|
+
globalOptions = {};
|
|
13
|
+
globalConfig;
|
|
14
|
+
applicationContext;
|
|
15
|
+
eventBus;
|
|
13
16
|
configure(options = {}) {
|
|
14
17
|
this.globalOptions = options;
|
|
15
18
|
return this;
|
|
@@ -85,6 +88,10 @@ class BootstrapStarter {
|
|
|
85
88
|
}
|
|
86
89
|
exports.BootstrapStarter = BootstrapStarter;
|
|
87
90
|
class Bootstrap {
|
|
91
|
+
static starter;
|
|
92
|
+
static logger;
|
|
93
|
+
static configured = false;
|
|
94
|
+
static bootstrapLoggerFactory = new logger_1.LoggerFactory();
|
|
88
95
|
/**
|
|
89
96
|
* set global configuration for midway
|
|
90
97
|
* @param configuration
|
|
@@ -222,6 +229,4 @@ class Bootstrap {
|
|
|
222
229
|
}
|
|
223
230
|
}
|
|
224
231
|
exports.Bootstrap = Bootstrap;
|
|
225
|
-
Bootstrap.configured = false;
|
|
226
|
-
Bootstrap.bootstrapLoggerFactory = new logger_1.LoggerFactory();
|
|
227
232
|
//# sourceMappingURL=bootstrap.js.map
|
package/dist/interface.d.ts
CHANGED
package/dist/manager/base.js
CHANGED
|
@@ -8,15 +8,18 @@ const events_1 = require("events");
|
|
|
8
8
|
const util_2 = require("util");
|
|
9
9
|
const debug = (0, util_2.debuglog)('midway:bootstrap');
|
|
10
10
|
class AbstractForkManager {
|
|
11
|
+
options;
|
|
12
|
+
reforks = [];
|
|
13
|
+
disconnectCount = 0;
|
|
14
|
+
unexpectedCount = 0;
|
|
15
|
+
disconnects = {};
|
|
16
|
+
hub = new events_1.EventEmitter();
|
|
17
|
+
workers = new Map();
|
|
18
|
+
eventBus;
|
|
19
|
+
isClosing = false;
|
|
20
|
+
exitListener;
|
|
11
21
|
constructor(options) {
|
|
12
22
|
this.options = options;
|
|
13
|
-
this.reforks = [];
|
|
14
|
-
this.disconnectCount = 0;
|
|
15
|
-
this.unexpectedCount = 0;
|
|
16
|
-
this.disconnects = {};
|
|
17
|
-
this.hub = new events_1.EventEmitter();
|
|
18
|
-
this.workers = new Map();
|
|
19
|
-
this.isClosing = false;
|
|
20
23
|
options.count = options.count || os.cpus().length - 1;
|
|
21
24
|
options.refork = options.refork !== false;
|
|
22
25
|
options.limit = options.limit || 60;
|
package/dist/manager/cp.d.ts
CHANGED
package/dist/manager/cp.js
CHANGED
|
@@ -8,6 +8,7 @@ const util_1 = require("util");
|
|
|
8
8
|
const core_1 = require("@midwayjs/core");
|
|
9
9
|
const debug = (0, util_1.debuglog)('midway:bootstrap');
|
|
10
10
|
class ClusterManager extends base_1.AbstractForkManager {
|
|
11
|
+
options;
|
|
11
12
|
constructor(options = {}) {
|
|
12
13
|
super(options);
|
|
13
14
|
this.options = options;
|
package/dist/manager/thread.d.ts
CHANGED
package/dist/manager/thread.js
CHANGED
|
@@ -6,6 +6,8 @@ const worker_threads_1 = require("worker_threads");
|
|
|
6
6
|
const event_bus_1 = require("@midwayjs/event-bus");
|
|
7
7
|
const core_1 = require("@midwayjs/core");
|
|
8
8
|
class ThreadManager extends base_1.AbstractForkManager {
|
|
9
|
+
options;
|
|
10
|
+
workerExitListener;
|
|
9
11
|
constructor(options = {}) {
|
|
10
12
|
super(options);
|
|
11
13
|
this.options = options;
|
package/dist/sticky.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setupStickyMaster = setupStickyMaster;
|
|
4
|
+
exports.setupWorker = setupWorker;
|
|
4
5
|
const cluster = require('cluster');
|
|
5
6
|
const crypto_1 = require("crypto");
|
|
6
7
|
const randomId = () => (0, crypto_1.randomBytes)(8).toString('hex');
|
|
@@ -107,7 +108,6 @@ function setupStickyMaster(httpServer, opts = {}) {
|
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
|
-
exports.setupStickyMaster = setupStickyMaster;
|
|
111
111
|
function setupWorker(io) {
|
|
112
112
|
// store connections that may receive multiple chunks
|
|
113
113
|
const sockets = new Map();
|
|
@@ -145,5 +145,4 @@ function setupWorker(io) {
|
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
exports.setupWorker = setupWorker;
|
|
149
148
|
//# sourceMappingURL=sticky.js.map
|
package/dist/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.logDate = logDate;
|
|
4
|
+
exports.sleep = sleep;
|
|
4
5
|
function logDate() {
|
|
5
6
|
const d = new Date();
|
|
6
7
|
let date = d.getDate();
|
|
@@ -44,11 +45,9 @@ function logDate() {
|
|
|
44
45
|
'.' +
|
|
45
46
|
milliseconds);
|
|
46
47
|
}
|
|
47
|
-
exports.logDate = logDate;
|
|
48
48
|
async function sleep(timeout) {
|
|
49
49
|
return new Promise(resolve => {
|
|
50
50
|
setTimeout(resolve, timeout);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
exports.sleep = sleep;
|
|
54
53
|
//# sourceMappingURL=util.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/bootstrap",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "midwayjs bootstrap",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@midwayjs/event-bus": "1.11.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
28
|
-
"@midwayjs/logger": "^
|
|
27
|
+
"@midwayjs/core": "^4.0.0-beta.10",
|
|
28
|
+
"@midwayjs/logger": "^4.0.0",
|
|
29
29
|
"request": "2.88.2",
|
|
30
30
|
"socket.io-client": "4.8.1"
|
|
31
31
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"url": "https://github.com/midwayjs/midway.git"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
38
|
+
"node": ">=20"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
|
|
41
41
|
}
|