File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/mongodb-log-writer/src Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ export class MongoLogManager {
6363
6464 /** Clean up log files older than `retentionDays`. */
6565 async cleanupOldLogFiles ( maxDurationMs = 5_000 , remainingRetries = 1 ) : Promise < void > {
66+ const deletionStartTimestamp = Date . now ( ) ;
67+ // Delete files older than N days
68+ const deletionCutoffTimestamp =
69+ deletionStartTimestamp - this . _options . retentionDays * 86400 * 1000 ;
70+
6671 const dir = this . _options . directory ;
6772 let dirHandle ;
6873 try {
@@ -71,10 +76,6 @@ export class MongoLogManager {
7176 return ;
7277 }
7378
74- const deletionStartTimestamp = Date . now ( ) ;
75- // Delete files older than N days
76- const deletionCutoffTimestamp =
77- deletionStartTimestamp - this . _options . retentionDays * 86400 * 1000 ;
7879 // Store the known set of least recent files in a heap in order to be able to
7980 // delete all but the most recent N files.
8081 const leastRecentFileHeap = new Heap < {
You can’t perform that action at this time.
0 commit comments