Browse Source

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

hl 3 weeks ago
parent
commit
62d534a98f
1 changed files with 8 additions and 6 deletions
  1. 8 6
      src/utils/file.js

+ 8 - 6
src/utils/file.js

@@ -104,13 +104,15 @@ function getLastFile(dirPath, number, callback) {
             for (file of files) {
                 const filePath = path.join(dirPath, file);
                 // logger.info("所有文件:",filePath)
-                const stats =  fs.promises.stat(filePath);
-                if (stats.isFile()) {
-                    let tt = stats.birthtime.getTime()
-                    fileList.push({name: file, time: tt});
-                    logger.info("----------------所有文件:" + filePath + "时间:" + tt)
-                }
+                fs.promises.stat(filePath).then((stats) =>{
+                    if (stats.isFile()) {
+                        let tt = stats.birthtime.getTime()
+                        fileList.push({name: file, time: tt});
+                        logger.info("----------------所有文件:" + filePath + "时间:" + tt)
+                    }
+                });
             }
+
             for (a of fileList) {
                 const filePath = path.join(dirPath, a.name);
                 logger.info("复查:" + filePath + "\ttime:" + a.time)