Browse Source

将日志 与 机器人状态详情进行缓存,

hl 3 weeks ago
parent
commit
2b9a4fca08
1 changed files with 7 additions and 6 deletions
  1. 7 6
      src/Interval.js

+ 7 - 6
src/Interval.js

@@ -120,14 +120,15 @@ function cacheLogs() {
             file.checkPathSync(directoryPath)
             file.getLastFile(logPath, 5,  (fileNameList, _) => {
                 logger.info('-----文件:', fileNameList);
-                let result =  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);