Skip to content

Commit 929ae7b

Browse files
committed
fixup: account for async analyze document in import export gather fields
1 parent 69eab88 commit 929ae7b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/compass-import-export/src/export/gather-fields.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ async function _gatherFields({
8787
const analyzeStream = new Transform({
8888
objectMode: true,
8989
transform: (doc: Document, encoding, callback) => {
90-
schemaAnalyzer.analyzeDoc(doc);
91-
result.docsProcessed++;
92-
progressCallback?.(result.docsProcessed);
93-
callback();
90+
schemaAnalyzer
91+
.analyzeDoc(doc)
92+
.then(() => {
93+
result.docsProcessed++;
94+
progressCallback?.(result.docsProcessed);
95+
callback();
96+
})
97+
.catch(callback);
9498
},
9599
});
96100

0 commit comments

Comments
 (0)