Log elements when cannot bulk index

This commit is contained in:
Chocobozzz 2024-03-28 10:22:23 +01:00
parent fa11e5c655
commit 8eb43d3686
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 4 deletions

View File

@ -105,15 +105,15 @@ export abstract class AbstractIndexer <T extends IndexableDoc, DB> {
if (this.bulkIndexationTimer) return
this.bulkIndexationTimer = setTimeout(async () => {
try {
const elements = this.elementsToBulkIndex
this.elementsToBulkIndex = []
const elements = this.elementsToBulkIndex
this.elementsToBulkIndex = []
try {
logger.info(`Bulk indexing ${elements.length} elements in ${this.indexName}`)
this.bulkProcessEnqueuedTask = await this.indexElements(elements)
} catch (err) {
logger.error({ err }, 'Cannot schedule bulk indexation')
logger.error({ err, elements }, 'Cannot schedule bulk indexation')
} finally {
this.bulkIndexationTimer = undefined
}