in src/shippers/elastic_v3/server/src/server_shipper.ts [160:174]
public async flush() {
if (this.flush$.isStopped) {
// If called after shutdown, return straight away
return;
}
const promise = firstValueFrom(
this.inFlightRequests$.pipe(
skip(1), // Skipping the first value because BehaviourSubjects always emit the current value on subscribe.
filter((count) => count === 0) // Wait until all the inflight requests are completed.
)
);
this.flush$.next();
await promise;
}