Merge branch 'master' into SDA-2824-Set-Notif-Pos-Darkmode

This commit is contained in:
psjostrom
2021-01-15 11:49:25 +01:00
committed by GitHub
+6 -4
View File
@@ -251,10 +251,12 @@ class Logger {
const deleteTimeStamp = new Date().getTime() - (5 * 24 * 60 * 60 * 1000);
files.forEach((file) => {
const filePath = path.join(this.logPath, file);
const stat = fs.statSync(filePath);
const fileTimestamp = new Date(util.inspect(stat.mtime)).getTime();
if ((fileTimestamp < deleteTimeStamp) && fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
if (fs.existsSync(filePath)) {
const stat = fs.statSync(filePath);
const fileTimestamp = new Date(util.inspect(stat.mtime)).getTime();
if ((fileTimestamp < deleteTimeStamp)) {
fs.unlinkSync(filePath);
}
}
});
}