@@ -18,7 +18,7 @@ interface MongoLogOptions {
18
18
/** The maximal number of log files which are kept. */
19
19
maxLogFileCount ?: number ;
20
20
/** The maximal GB of log files which are kept. */
21
- logRetentionGB ?: number ;
21
+ retentionGB ?: number ;
22
22
/** A handler for warnings related to a specific filesystem path. */
23
23
onerror : ( err : Error , path : string ) => unknown | Promise < void > ;
24
24
/** A handler for errors related to a specific filesystem path. */
@@ -72,10 +72,10 @@ export class MongoLogManager {
72
72
// with network latency.
73
73
if ( Date . now ( ) - deletionStartTimestamp > maxDurationMs ) break ;
74
74
75
- if ( ! dirent . isFile ( ) ) continue ;
76
- const { id } =
75
+ if ( ! dirent . isFile ( ) ) continue ; retentionGB
76
+ const { id } = retentionGB
77
77
/ ^ ( ?< id > [ a - f0 - 9 ] { 24 } ) _log ( \.gz ) ?$ / i . exec ( dirent . name ) ?. groups ?? { } ;
78
- if ( ! id ) continue ;
78
+ if ( ! id ) continue ; retentionGB
79
79
const fileTimestamp = + new ObjectId ( id ) . getTimestamp ( ) ;
80
80
const fullPath = path . join ( dir , dirent . name ) ;
81
81
let toDelete :
@@ -110,11 +110,11 @@ export class MongoLogManager {
110
110
} ) ;
111
111
112
112
const reachedMaxStorageSize = usedStorageSize > storageSizeLimit ;
113
- const reachedMaxFileCount =
113
+ const reachedMretentionGB
114
114
this . _options . maxLogFileCount &&
115
115
leastRecentFileHeap . size ( ) > this . _options . maxLogFileCount ;
116
116
117
- if ( reachedMaxStorageSize || reachedMaxFileCount ) {
117
+ if ( reachedMaxStorretentionGBchedMaxFileCount ) {
118
118
toDelete = leastRecentFileHeap . pop ( ) ;
119
119
}
120
120
}
0 commit comments