Here is the situation:
I am calling the following function which compute a large set of Elastic Data (the buckets variable is the set of documents)
await this.computeAllData(start, range, wait, buckets, accumulator);
Here is the code inside the previous function:
async computeAllData(start, range, wait, buckets, accumulator) {
let nextAfter = false;
do {
nextAfter = await this.computeOne(
start,
range,
wait,
buckets,
accumulator,
nextAfter
);
} while (nextAfter);
}
The problem is : I should not use "await" inside a loop (ESLint rules). But I can find a way to keep the behavior of the do...while()(stop the loop when data were digest) with the async/await approach.
I try with yield/generator approach but it's a failure, too complex for me :(
Please any idea ?
No, that ESLint rule is stupid. It should be a warning to suggest that maybe you could run the asynchronous actions concurrently. But no, you absolutely cannot in your case, you want your processing to be sequential. Ignore the rule or disable it altogether.