ee-core 2.10.0 → 2.10.2

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/config/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const Storage = require('../storage');
2
+ const ConfigCache = require('./cache');
2
3
  var SystemDb = undefined;
3
4
 
4
5
  const Cfg = {
@@ -15,7 +16,12 @@ const Cfg = {
15
16
  /**
16
17
  * all
17
18
  */
18
- all() {
19
+ all(fromCache = true) {
20
+ if (fromCache === true) {
21
+ // 如果子进程
22
+ const cacheValue = ConfigCache.all();
23
+ return cacheValue;
24
+ }
19
25
  const cdb = this._getCoreDB();
20
26
  const config = cdb.getItem('config');
21
27
 
@@ -45,7 +51,12 @@ const Cfg = {
45
51
  /**
46
52
  * getValue
47
53
  */
48
- getValue(key) {
54
+ getValue(key, fromCache = true) {
55
+ if (fromCache === true) {
56
+ const cacheValue = ConfigCache.getValue(key);
57
+ return cacheValue;
58
+ }
59
+
49
60
  const cdb = this._getCoreDB();
50
61
  let v = cdb.getConfigItem(key);
51
62
 
package/jobs/child/app.js CHANGED
@@ -5,13 +5,6 @@ const Loader = require('ee-core/loader');
5
5
  const Log = require('ee-core/log');
6
6
  const UtilsCore = require('ee-core/core/lib/utils');
7
7
 
8
- // 开发环境下,ee-core是soft link
9
- // /node_modules[\\/]electron[\\/]/.test(process.execPath)
10
- // const Exception = require('../../exception');
11
- // const Loader = require('../../loader');
12
- // const Log = require('../../log');
13
- // const UtilsCore = require('../../core/lib/utils');
14
-
15
8
  Exception.start();
16
9
  const commands = ['run'];
17
10
 
package/log/logger.js CHANGED
@@ -4,8 +4,13 @@ const dayjs = require('dayjs');
4
4
  const path = require('path');
5
5
  const Ps = require('../ps');
6
6
  const Conf = require('../config');
7
- const ConfCache = require('../config/cache');
7
+ const ConfigCache = require('../config/cache');
8
8
  let LogDate = 0;
9
+ const TmpFileName = {
10
+ appLogName: '',
11
+ coreLogName: '',
12
+ errorLogName: '',
13
+ }
9
14
 
10
15
  module.exports = {
11
16
 
@@ -39,10 +44,10 @@ module.exports = {
39
44
  customLogger: {}
40
45
  }
41
46
 
42
- // 先从 cache 中读配置,如果没有从文件中读(子进程无法获取 cache)
43
- let sysConfig = ConfCache.all(false);
47
+ // 先从 cache 中读配置且不能抛出错误,如果没有从文件中读(子进程无法获取 cache)
48
+ let sysConfig = ConfigCache.all(false);
44
49
  if (!sysConfig) {
45
- sysConfig = Conf.all();
50
+ sysConfig = Conf.all(false);
46
51
  }
47
52
  opt = Object.assign(defaultConfig, {
48
53
  logger: sysConfig.logger,
@@ -73,9 +78,20 @@ module.exports = {
73
78
  let now = parseInt(dayjs().format('YYYYMMDD'));
74
79
  if (LogDate != now) {
75
80
  LogDate = now;
76
- let appLogName = logOpt.logger.appLogName;
77
- let coreLogName = logOpt.logger.coreLogName;
78
- let errorLogName = logOpt.logger.errorLogName;
81
+
82
+ // 保存一个临时文件名,防止文件名按日期累加
83
+ if (TmpFileName.appLogName.length == 0) {
84
+ TmpFileName.appLogName = logOpt.logger.appLogName;
85
+ }
86
+ if (TmpFileName.coreLogName.length == 0) {
87
+ TmpFileName.coreLogName = logOpt.logger.coreLogName;
88
+ }
89
+ if (TmpFileName.errorLogName.length == 0) {
90
+ TmpFileName.errorLogName = logOpt.logger.errorLogName;
91
+ }
92
+ let appLogName = TmpFileName.appLogName;
93
+ let coreLogName = TmpFileName.coreLogName;
94
+ let errorLogName = TmpFileName.errorLogName;
79
95
  let appLogExtname = path.extname(appLogName);
80
96
  let coreLogExtname = path.extname(coreLogName);
81
97
  let errorLogExtname = path.extname(errorLogName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {