Skip to content

Commit d7a3e25

Browse files
committed
refactor: rename to retentionGB
1 parent b638b34 commit d7a3e25

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/mongodb-log-writer/src/mongo-log-manager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ describe('MongoLogManager', function () {
235235
.toString()
236236
.split('\n')
237237
.filter(Boolean)
238-
.map((line: string) => JSON.parse(line));
238+
retentionGBring) => JSON.parse(line));
239239
expect(log).to.have.lengthOf(1);
240240
expect(log[0].t.$date).to.be.a('string');
241241

packages/mongodb-log-writer/src/mongo-log-manager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)