[Data Forge] Restore queue.drain() (#188603)

This PR is a follow up to #187901 – It restores the `await
queue.drain()` function call in the `createEvents()` method. Without the
`queue.drain()` call, the script will run out of memory when indexing
more than 24 hours of data because it will generate events faster than
the queue can drain them and eventually run out of memory.
This commit is contained in:
Chris Cowan 2024-07-18 08:44:33 -06:00 committed by GitHub
parent 7b1dd6143d
commit 76f329dfb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,6 +117,7 @@ export async function createEvents(
.flat();
}
await queue.push(events);
await queue.drain();
} else {
logger.info({ took: 0, latency: 0, indexed: 0 }, 'Indexing 0 documents.');
}