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

215
Visualizações
Any limits for fetch Javascript API in Web Workers?

Browser : Chrome Latest (101.x)

I am currently using WebWorker to fetch image file like this.. In the web worker file,


    onmessage = function(oEvent) {
    
       var promises = [];
       for(var i = ..) {
          for(var j = ...) {
              (function(fI,sI) {
                    var p = new Promise((resolve, reject) => {
                                         .....
    
                                    fetch(urls[fI][sI]).then(...
                           });
                    promises.push(p);
              })(i,j)
          }
       }
       Promise.all(promises).then((results) => {
          ....blah..
    
       }
    }

No CORS concern...every urls point to the same domain...

Actually, the urls contains about 4000 image urls..

Let's say...the urls contain like this...for the sake of simplicity...it only contains a - z image files...

Say the server is blah.


    http://blah/..../a.jpg
    http://blah/..../b.jpg
    ...
    http://blah/..../z.jpg

I noticed that some of files are ok..but some of them throws "TypeError: Failed to fetch".... For examples, sometimes, I see a,b,c throws the error..... sometimes, g,h,x .....I don't see any apparent reason why.... I investigated those urls that return the error, but nothing wrong with those urls....They are all valid ones...

So I was thinking that I slammed too many requests...so I used setTimeout to request at different timing..but still it didn't resolve the issues...

Obviously, If I reduced the size of requests, that everything seems ok...

So are there any limits that I could make fetch requests under Web Worker? There is no way that I could make this work? I don't really care about performance for this..as long as I could fetch all of 4000 successfully...I should be fine...

Any ideas?

Thanks,

Updated: Here is the captured image..

Developer Tool Images for Debugging

I just captured the part of requests from the Developer Tool. fetching.js:45 ... it points to the fetch(urls[fI][sI]).then(... this line..

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