1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Chore: Desktop: Fixes #8598 - Recent logs appear to be deleted (#8605)

This commit is contained in:
Hubert
2023-08-08 07:18:59 -03:00
committed by GitHub
parent ce8470ee7c
commit ae8f32e6b4
2 changed files with 21 additions and 3 deletions

View File

@@ -29,7 +29,8 @@ export default class RotatingLogs {
const files: Stat[] = await this.fsDriver().readDirStats(this.logFilesDir);
for (const file of files) {
if (!file.path.match(/^log-[0-9]+.txt$/gi)) continue;
const ageOfTheFile: number = Date.now() - file.birthtime;
const timestamp: number = parseInt(file.path.match(/[0-9]+/g)[0], 10);
const ageOfTheFile: number = Date.now() - timestamp;
if (ageOfTheFile >= this.inactiveMaxAge) {
await this.fsDriver().remove(this.logFileFullpath(file.path));
}