2 Commits 154a43e7db ... 2b9a4fca08

Author SHA1 Message Date
  hl 2b9a4fca08 将日志 与 机器人状态详情进行缓存, 3 weeks ago
  hl 58ef9d3759 将日志 与 机器人状态详情进行缓存, 3 weeks ago
1 changed files with 9 additions and 8 deletions
  1. 9 8
      src/Interval.js

+ 9 - 8
src/Interval.js

@@ -105,7 +105,7 @@ function cacheLogs() {
     }, intervalInMilliseconds);
 }
 
-async function zz(value) {
+ function zz(value) {
     var thisTime = new Date().getTime()
     let port = value.port
     let n = 200
@@ -118,16 +118,17 @@ async function zz(value) {
             logger.info(`访问-日志相对目录:${logPath}`)
             const directoryPath = path.resolve(logPath);
             file.checkPathSync(directoryPath)
-            file.getLastFile(logPath, 5, async (fileNameList, _) => {
+            file.getLastFile(logPath, 5,  (fileNameList, _) => {
                 logger.info('-----文件:', fileNameList);
-                let result = await file.getLatestLogEntries(logPath, fileNameList.reverse(), n);
-                if (messlist.length === 0) {
-                    value.messlist = result
-                } else {
-                    if (messlist[0] !== result[0]) {
+                file.getLatestLogEntries(logPath, fileNameList.reverse(), n).then((result) =>{
+                    if (messlist.length === 0) {
                         value.messlist = result
+                    } else {
+                        if (messlist[0] !== result[0]) {
+                            value.messlist = result
+                        }
                     }
-                }
+                });
             });
         } catch (e) {
             logger.info('异步缓存日志异常~~', e);