0

I have to generate n signatures. For that I must invoke a promise n number of times. Do I have to use Promise.all? Is there another way?

const response = [];
for( let i = 0; i < n; i++ ){
    response.push(await generateSignature())
}

this gives me an eslint issue no-await-in-loop.

Klose
  • 323
  • 5
  • 17
  • 1
    If you need to make requests in serial, your current code is perfectly fine. If you 're able to make the requests in parallel, better to use `Promise.all`. – CertainPerformance Nov 24 '20 at 15:31
  • The no-await-in-loop rule is pretty pointless as you *want* to do stuff in sequence occasionally. – Bergi Nov 24 '20 at 15:45

0 Answers0