Don't swallow indexing failures

When an error occurs in the indexer pipeline, it logs it out, and then
drops it on the floor. This is problematic because externally, from
the task scheduler's perspective, it appears to have succeeded, which
is not true.

As a result, these failures are invisible to tooling which introspects
over tasks.

This makes the index task promise resolve when the pipeline finishes as
before, but it rejects if the pipeline failed.

Signed-off-by: Charles Lowell <cowboyd@frontside.com>
This commit is contained in:
Charles Lowell
2022-05-16 14:50:07 +03:00
parent b43dc9408d
commit bde1631c83
@@ -128,7 +128,7 @@ export class IndexBuilder {
const indexer = await this.searchEngine.getIndexer(type);
// Compose collator/decorators/indexer into a pipeline
return new Promise<void>(done => {
return new Promise<void>((resolve, reject) => {
pipeline(
[collator, ...decorators, indexer],
(error: NodeJS.ErrnoException | null) => {
@@ -136,12 +136,12 @@ export class IndexBuilder {
this.logger.error(
`Collating documents for ${type} failed: ${error}`,
);
reject(error);
} else {
// Signal index pipeline completion!
this.logger.info(`Collating documents for ${type} succeeded`);
resolve();
}
// Signal index pipeline completion!
done();
},
);
});