'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..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source