Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Chrome ERR_INSUFFICIENT_RESOURCES workaround

I have a JS library that is responsible to perform the download of JPEG images for the client. All of this is done asynchronously. In some cases, the count of images is really large... Around 5000 images. In this case, the Chrome browser issues the "ERR_INSUFFICIENT_RESOURCES" error for the ajax request.

Each request must be done individually, there is no option to pack the images on the server-side.

What are my options here? How can I find a workaround for this problem? The download works fine in Firefox...

Attached code of the actual download:

function loadFileAndDecrypt(fileId, key, type, length, callback, obj) {     

 var step = 100 / length;

 eventBus.$emit('updateProgressText', "downloadingFiles");


  var req = new dh.crypto.HttpRequest();
    req.setAesKey(key);
    let dataUrl;
    
    if (type == "study")  {
         dataUrl = "/v1/images/";
    }else {
         dataUrl = "/v1/dicoms/";
    }    

    var url = axios.defaults.baseURL + dataUrl + fileId;
    req.open("GET", url, true);
    req.setRequestHeader("Authorization", authHeader().Authorization+"")
    req.setRequestHeader("Accept", "application/octet-stream, application/json, text/plain, */*");
    req.responseType = "arraybuffer";

    req.onload = function() {
        console.log(downloadStep);    
        downloadStep +=  step;
        eventBus.$emit('updatePb', Math.ceil(downloadStep));

        var data = req.response;
        obj.push(data);
        counter ++;        
        //last one
        if (counter == length) {        
            callback(obj);        
        }
    };

    req.send();
}
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

The error means your code is overloading your memory (most likely, or the quota of pending requests was exhausted). Instead of sending all the data from the backend, make your frontend request for 5000 individual images instead and control the requests flow. regardless, downloading 5000 images is bad. You should pack them up for downloading. If you mean fetching the images, then loading images from the frontend through static or dynamic links is much more logical ;)

over 4 years ago · Santiago Trujillo Denunciar

0

Create a class:

  • Which accepts the file-Id (image that needs to be downloaded) as an argument
  • Which can perform the HTTP API request
  • Which can store the result of the request

Create an array of objects from this class using how many ever file-Ids that needs to be downloaded.

Store the array in a RequestManager which can start and manage the downloads:

  • can batch the downloads, say it fires 5 requests from the array and waits for them to finish before starting the next batch
  • can stop the downloads on multiple failures
  • manipulate batch size depending on the available bandwidth
  • stops download on auth expiry and resumes on auth refresh
  • offers to retry the previously failed downloads
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda