diff --git a/src/services/file.js b/src/services/file.js index 9cb1096..94001f1 100644 --- a/src/services/file.js +++ b/src/services/file.js @@ -47,7 +47,7 @@ class FileService { deleteOldFiles() { const directoryPath = path.join(basedir, 'public/csv'); const files = fs.readdirSync(directoryPath); - const oneDay = 24 * 60 * 60 * 1000; // Un jour en millisecondes + const oneDay = 48 * 60 * 60 * 1000; // Un jour en millisecondes const currentDate = new Date(); emitter.emit('deleteOldFiles.start', { files, directoryPath }); @@ -76,14 +76,14 @@ class FileService { emitter.emit('checkLastOperationDate.start', { dateFilePath }); try { - const oneDay = 24 * 60 * 60 * 1000; // Un jour en millisecondes + const oneDay = 48 * 60 * 60 * 1000; // Un jour en millisecondes const currentDate = new Date(); // Check if file exists and create it if not with a default date of 48 hours ago if (!fs.existsSync(dateFilePath)) { emitter.emit('checkLastOperationDate.created', { dateFilePath }); - const twodaysdate = new Date(currentDate - (2*oneDay)); + const twodaysdate = new Date(currentDate - (1.5*oneDay)); fs.writeFileSync(dateFilePath, twodaysdate.toISOString(), 'utf-8'); }