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

This commit is contained in:
Vishwas Shashidhar 2020-03-18 13:58:31 +05:30 committed by GitHub
parent 873badf389
commit 165320d83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}
});