SDA-1885 Javascript Error on cleaning logs (#927)

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>
This commit is contained in:
Vishwas Shashidhar
2020-03-18 18:26:47 +05:30
committed by GitHub
parent 1d55792d35
commit 3856990b7b

View File

@@ -250,7 +250,7 @@ class Logger {
const filePath = path.join(this.logPath, file);
const stat = fs.statSync(filePath);
const fileTimestamp = new Date(util.inspect(stat.mtime)).getTime();
if (fileTimestamp < deleteTimeStamp) {
if ((fileTimestamp < deleteTimeStamp) && fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
});