@@ -18,7 +18,7 @@ interface MongoLogOptions {
1818 /** The maximal number of log files which are kept. */
1919 maxLogFileCount ?: number ;
2020 /** The maximal GB of log files which are kept. */
21- logRetentionGB ?: number ;
21+ retentionGB ?: number ;
2222 /** A handler for warnings related to a specific filesystem path. */
2323 onerror : ( err : Error , path : string ) => unknown | Promise < void > ;
2424 /** A handler for errors related to a specific filesystem path. */
@@ -72,10 +72,10 @@ export class MongoLogManager {
7272 // with network latency.
7373 if ( Date . now ( ) - deletionStartTimestamp > maxDurationMs ) break ;
7474
75- if ( ! dirent . isFile ( ) ) continue ;
76- const { id } =
75+ if ( ! dirent . isFile ( ) ) continue ; retentionGB
76+ const { id } = retentionGB
7777 / ^ ( ?< id > [ a - f0 - 9 ] { 24 } ) _log ( \.gz ) ?$ / i . exec ( dirent . name ) ?. groups ?? { } ;
78- if ( ! id ) continue ;
78+ if ( ! id ) continue ; retentionGB
7979 const fileTimestamp = + new ObjectId ( id ) . getTimestamp ( ) ;
8080 const fullPath = path . join ( dir , dirent . name ) ;
8181 let toDelete :
@@ -110,11 +110,11 @@ export class MongoLogManager {
110110 } ) ;
111111
112112 const reachedMaxStorageSize = usedStorageSize > storageSizeLimit ;
113- const reachedMaxFileCount =
113+ const reachedMretentionGB
114114 this . _options . maxLogFileCount &&
115115 leastRecentFileHeap . size ( ) > this . _options . maxLogFileCount ;
116116
117- if ( reachedMaxStorageSize || reachedMaxFileCount ) {
117+ if ( reachedMaxStorretentionGBchedMaxFileCount ) {
118118 toDelete = leastRecentFileHeap . pop ( ) ;
119119 }
120120 }
0 commit comments