jsir 3.0.1 → 3.0.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/deps/room.js +6 -4
- package/deps/util.js +2 -1
- package/package.json +1 -1
package/deps/room.js
CHANGED
|
@@ -368,11 +368,11 @@ async function syncConfigs() {
|
|
|
368
368
|
let currText = String(await fp.readFile(path));
|
|
369
369
|
if (currText !== text) {
|
|
370
370
|
await fp.writeFile(path, text)
|
|
371
|
-
console.$debug(`
|
|
371
|
+
console.$debug(`update config ${key} success`);
|
|
372
372
|
}
|
|
373
373
|
} else {
|
|
374
374
|
await fp.writeFile(path, text)
|
|
375
|
-
console.$debug(`
|
|
375
|
+
console.$debug(`create config ${key} success`);
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
@@ -535,10 +535,12 @@ async function reqNode(node, method, url, port, body) {
|
|
|
535
535
|
});
|
|
536
536
|
|
|
537
537
|
// 设置超时逻辑
|
|
538
|
-
|
|
538
|
+
let timeoutMs = setting.reqNodeTimeouts[url];
|
|
539
|
+
if (timeoutMs) {
|
|
539
540
|
timeout = setTimeout(() => {
|
|
540
541
|
req.destroy(); // 中断请求
|
|
541
|
-
|
|
542
|
+
reject(new Error(`Timeout ${timeoutMs}ms`))
|
|
543
|
+
}, timeoutMs); // 10秒超时
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
// 错误处理
|
package/deps/util.js
CHANGED
|
@@ -844,7 +844,8 @@ function createLimitLogger(fileName, {
|
|
|
844
844
|
setting.newError = true;
|
|
845
845
|
}
|
|
846
846
|
if (time) {
|
|
847
|
-
|
|
847
|
+
let prefix = debugStr(`${timeStr('YYYY-MM-DD HH:mm:ss.SSS')} ${String(process.pid%1000).padStart(3, '0')}>`)
|
|
848
|
+
text = `${prefix} ${text}`
|
|
848
849
|
}
|
|
849
850
|
fp.appendFile(logPath, text + '\n')
|
|
850
851
|
let _minNum = (Date.now()/(1000 * 60 * 10)).toFixed(0)
|