diff --git a/server/lib/indexers/shared/abstract-indexer.ts b/server/lib/indexers/shared/abstract-indexer.ts index 31db4c8..b865938 100644 --- a/server/lib/indexers/shared/abstract-indexer.ts +++ b/server/lib/indexers/shared/abstract-indexer.ts @@ -112,16 +112,17 @@ export abstract class AbstractIndexer { logger.info(`Bulk indexing ${elements.length} elements in ${this.indexName}`) this.bulkProcessEnqueuedTask = await this.indexElements(elements) - - this.bulkIndexationTimer = undefined } catch (err) { logger.error({ err }, 'Cannot schedule bulk indexation') + } finally { + this.bulkIndexationTimer = undefined } }, CONFIG.INDEXER.BULK_INDEXATION_INTERVAL_MS) } private async indexElements (elements: T[]) { const documents = elements.map(e => this.formatterFn(e)) + .filter(e => !!e) const result = await client.index(this.indexName).updateDocuments(documents, { primaryKey: this.primaryKey.toString() }) logger.debug(result, 'Indexed ' + documents.length + ' documents in ' + this.indexName)