Merge pull request #14665 from RoadieHQ/wait-for-intialize

wait for initialize to complete before finalize
This commit is contained in:
Fredrik Adelöw
2022-11-17 13:07:09 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-node': patch
---
Wait for indexer initialization before finalizing indexing.
@@ -111,6 +111,12 @@ export abstract class BatchSearchEngineIndexer extends Writable {
*/
async _final(done: (error?: Error | null) => void) {
try {
const maybeError = await this.initialized;
if (maybeError) {
done(maybeError);
return;
}
// Index any remaining documents.
if (this.currentBatch.length) {
await this.index(this.currentBatch);