mm_os 4.3.2 → 4.3.3

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/com/api/index.js CHANGED
@@ -67,6 +67,11 @@ class Api extends Manager {
67
67
  * @type {number}
68
68
  */
69
69
  mode: process.env.NODE_ENV === "production" ? 1 : 3,
70
+ /**
71
+ * 最大深度
72
+ * @type {number}
73
+ */
74
+ max_depth: 6
70
75
  };
71
76
 
72
77
  /**
package/com/mqtt/index.js CHANGED
@@ -92,6 +92,11 @@ class Mqtt extends Manager {
92
92
  // maxInflight: 20,
93
93
  // 重连间隔
94
94
  reconnet_period: 6000, // 重连间隔1秒
95
+ /**
96
+ * 最大深度
97
+ * @type {number}
98
+ */
99
+ max_depth: 6
95
100
  };
96
101
 
97
102
  /**
@@ -67,6 +67,11 @@ class Socket extends Manager {
67
67
  * @type {number}
68
68
  */
69
69
  mode: process.env.NODE_ENV === 'production' ? 1 : 3,
70
+ /**
71
+ * 最大深度
72
+ * @type {number}
73
+ */
74
+ max_depth: 6
70
75
  };
71
76
 
72
77
  /**
@@ -67,6 +67,11 @@ class Static extends Manager {
67
67
  * @type {number}
68
68
  */
69
69
  mode: process.env.NODE_ENV === "production" ? 1 : 3,
70
+ /**
71
+ * 最大深度
72
+ * @type {number}
73
+ */
74
+ max_depth: 6
70
75
  };
71
76
 
72
77
  /**
package/com/task/index.js CHANGED
@@ -67,6 +67,11 @@ class Task extends Manager {
67
67
  * @type {number}
68
68
  */
69
69
  mode: process.env.NODE_ENV === "production" ? 1 : 3,
70
+ /**
71
+ * 最大深度
72
+ * @type {number}
73
+ */
74
+ max_depth: 6
70
75
  };
71
76
 
72
77
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mm_os",
3
3
  "description": "MM_OS服务端架构,用于快速构建应用程序,支持网站建设、小程序后台、AI应用、物联网(IOT/AIOT)、游戏服务端等多种场景。",
4
- "version": "4.3.2",
4
+ "version": "4.3.3",
5
5
  "main": "index.js",
6
6
  "keywords": [
7
7
  "AI",
@@ -36,20 +36,15 @@
36
36
  "koa-send": "^5.0.1",
37
37
  "koa-websocket": "^7.0.0",
38
38
  "markdown": "^0.5.0",
39
- "mm_ai": "^1.3.7",
39
+ "mm_ai": "^1.4.1",
40
40
  "mm_check": "^1.5.3",
41
41
  "mm_email": "^1.0.8",
42
42
  "mm_excel": "^1.2.2",
43
- "mm_expand": "^2.4.7",
44
43
  "mm_git": "^1.0.2",
45
- "mm_html": "^1.1.7",
46
- "mm_https": "^1.6.6",
47
44
  "mm_ip": "^1.0.4",
48
- "mm_logs": "^1.6.9",
49
45
  "mm_matchs": "^1.1.9",
50
46
  "mm_queue": "^1.0.3",
51
47
  "mm_session": "^1.6.1",
52
- "mm_sql": "^1.6.1",
53
48
  "mm_statics": "^1.8.7",
54
49
  "mm_xml": "^1.1.8",
55
50
  "mqtt": "^5.15.2"
package/server.js CHANGED
@@ -333,6 +333,7 @@ Server.prototype._initMiddlewareManager = async function () {
333
333
  * 初始化管理器
334
334
  */
335
335
  Server.prototype._initManager = async function () {
336
+ console.time(' [加载] _initManager');
336
337
  // 管理器配置列表
337
338
  var infos = [
338
339
  { name: 'game', title: '游戏', Module: Game },
@@ -342,17 +343,27 @@ Server.prototype._initManager = async function () {
342
343
 
343
344
  // 管理器实例集合
344
345
  var promises = [];
346
+ var labels = [];
345
347
 
346
348
  // 使用for循环初始化所有管理器
347
349
  for (var i = 0; i < infos.length; i++) {
348
350
  var config = infos[i];
351
+ var label = ' [加载] manager_' + config.name;
352
+ console.time(label);
349
353
  var manager = this._createManager(config.name, config.title, config.Module);
350
354
  promises.push(manager.do('load'));
355
+ labels.push(label);
351
356
  }
352
357
  // 初始化中间件管理器
358
+ var midd_label = ' [加载] manager_middleware';
359
+ console.time(midd_label);
353
360
  var midd = await this._initMiddlewareManager();
354
361
  promises.push(midd.do('load'));
362
+ labels.push(midd_label);
355
363
  await Promise.all(promises);
364
+ for (var j = 0; j < labels.length; j++) {
365
+ console.timeEnd(labels[j]);
366
+ }
356
367
  };
357
368
 
358
369
  /**
@@ -563,21 +574,32 @@ Server.prototype._stopSources = async function () {
563
574
  * @returns {object} 服务器实例
564
575
  */
565
576
  Server.prototype.run = async function () {
566
- // 初始化
567
- console.time('加载');
577
+ // 加载
578
+ console.time('[加载] 总计');
568
579
  await this.do('load');
569
- console.timeEnd('加载');
580
+ console.timeEnd('[加载] 总计');
570
581
 
571
582
  // 初始化
572
- console.time('初始化');
583
+ console.time('[初始化] 总计');
573
584
  await this.do('init');
574
- console.timeEnd('初始化');
585
+ console.timeEnd('[初始化] 总计');
575
586
 
576
587
  // 启动
577
- console.time('启动');
588
+ console.time('[启动] 总计');
578
589
  await this.do('start');
579
- console.timeEnd('启动');
590
+ console.timeEnd('[启动] 总计');
580
591
  return this;
581
592
  };
582
593
 
594
+ /**
595
+ * 使用中间件
596
+ * @param {object} cs 中间件实例
597
+ * @param {object} config 配置参数
598
+ */
599
+ Server.prototype.use = async function (cs, config) {
600
+ if (cs && typeof cs.install === 'function') {
601
+ await cs.install(this, config);
602
+ }
603
+ };
604
+
583
605
  exports.Server = Server;