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

176
Visualizações
Fetching data with fetch api is not async

i have multiple devices which i want to fire a command over a api But using fetch is not working as expected. As you can see in the picture, 9 requests takes about a minute to finish, because the execution takes about 6 seconds per request. If i fire the command, they all appear in the dev console, but "pending" Why this is not working?

enter image description here

enter image description here

async function getExecuteOutput(devices, formData) {

    $.each(devices, async function( index, value ) {
        fetch(
            '/api/execute.php',
            {
                method: 'POST',
                body: foormData
            }
        ).then((resp) => resp.json()).then(response => {
            console.log(response);
        });
    });
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The screenshot shows they are running in parallel. You can see the green bars in the screenshot starting at the same point. (Up to a point anyway: browsers limit the number of HTTP requests they can have in flight to the same server).

Your server-side code's inability to handle that (probably due to database locking) has nothing to do with fetch.

about 4 years ago · Juan Pablo Isaza Relatório
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