Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Is there a way native javasacript way to prevent excessive memory usage without await in loops?

I see that ES Lint is discouraging the use of await in loops, but I don't see any other native-language based option to prevent randomly excessive memory usage when the process inside the loop requires a lot of memory.

I understand that this could be prevented with the use of promise queues, but those have to be implemented or imported in a library.

Why are they promoting this kind of reckless use of memory and resources?

If I run all the processes "at once" with Promise.all() when each process can consume a highly random amount of memory, and there could be a huge amount of items to process, the script will likely crash, wouldn't it?

Or can you confirm if when using Promise.all() javascript will handle the memory properly to ensure that the memory is not exhausted by running all processes at once?

And what if the process opens network connections and have millions of items to process? I can easily hit the maximum network connections of the OS, and would have to put in place more mechanisms to queue those.

Why is it so wrong to use a simple await in a loop? They say the only reasonable reason for using awaits in a loop is when the iterations need information from each other, but just to prevent excessive resource consumption seems reasonable enough to me, isn't it?

Is there an alternative language-native way to run asynchronous heavy processes over a large list of items without risking excessive resource consumption?

Am i misunderstanding the ES Lint recommendations?

Here is the link: https://eslint.org/docs/rules/no-await-in-loop

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda