Browse Source

优化日志获取-发现长时间获取会触发100CPU,本次优化尝试解决该问题

hl 5 months ago
parent
commit
b2a813618a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/web.js

+ 2 - 2
src/web.js

@@ -93,8 +93,8 @@ function init() {
 
                 file.getLastFile(logPath, 5, async (fileNameList, _) => {
                     // logger.info('cccccccccccccc文件:', fileNameList);
-                    // result = await file.readLastNLines(logPath, fileNameList, n);
-                    result =  await  file.getRecentLogs(logPath,fileNameList.reverse(),n);
+                    result = await file.readLastNLines(logPath, fileNameList, n);
+                    // result =  await  file.getRecentLogs(logPath,fileNameList.reverse(),n);
 
                     // logger.info('?????:', result);
                     res.send({'code': 200, 'data': result, "message": "SUCCESS"});