ee-core 2.10.0 → 2.10.1
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 +13 -2
- package/jobs/child/app.js +0 -7
- package/log/logger.js +4 -4
- package/package.json +1 -1
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,7 +4,7 @@ const dayjs = require('dayjs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const Ps = require('../ps');
|
|
6
6
|
const Conf = require('../config');
|
|
7
|
-
const
|
|
7
|
+
const ConfigCache = require('../config/cache');
|
|
8
8
|
let LogDate = 0;
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
@@ -39,10 +39,10 @@ module.exports = {
|
|
|
39
39
|
customLogger: {}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// 先从 cache
|
|
43
|
-
let sysConfig =
|
|
42
|
+
// 先从 cache 中读配置且不能抛出错误,如果没有从文件中读(子进程无法获取 cache)
|
|
43
|
+
let sysConfig = ConfigCache.all(false);
|
|
44
44
|
if (!sysConfig) {
|
|
45
|
-
sysConfig = Conf.all();
|
|
45
|
+
sysConfig = Conf.all(false);
|
|
46
46
|
}
|
|
47
47
|
opt = Object.assign(defaultConfig, {
|
|
48
48
|
logger: sysConfig.logger,
|