Skip to content

Commit 826304a

Browse files
committed
Reduce memory usage by clearing strings
1 parent d86a3e1 commit 826304a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/archivist/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ export default class Archivist extends events.EventEmitter {
144144
return;
145145
}
146146

147-
return this.recordVersion(terms, extractOnly);
147+
await this.recordVersion(terms, extractOnly);
148+
149+
terms.sourceDocuments.forEach(sourceDocument => {
150+
sourceDocument.content = null; // Reduce memory usage by clearing no longer needed large content strings
151+
sourceDocument.mimeType = null; // …and associated MIME type
152+
sourceDocument.snapshotId = null; // …and associated snapshot ID for consistency
153+
});
148154
}
149155

150156
async fetchSourceDocuments(terms) {

0 commit comments

Comments
 (0)