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

339
Vistas
i have this error :exceeded maximum execution time (line 0)?

I call the api to search into the json based on skus ,the user will put the sku and the start time ,dthen the function will bee count how many orders we have for this sku on this day

This is my code:

// to call the page 
    function firstCall(pag,start){
    
    
      try{

    var url ='https://*****************************?Page=' + pag + '&shopId%5B%5D=90841&pageSize=250' + '&' + 'minOrderDate='+ start;
        var res =UrlFetchApp.fetch(url);
        var content = res.getContentText();
        
        var json= JSON.parse(content);
       
    var node = json.data;
    
     return node;
    
    
      }
      catch(err){
          return "Error getting data" + err;
      }
    }
    
    //to count how many order per day and per sku
    function getInven3(sKu,start){
     if(start == "")  return "!";
     start ="2021-11-17T";
    
      try{
        
    
    
          var url ='https://*********************************?shopId%5B%5D=90841&pageSize=250' + '&' + 'minOrderDate='+ start;
    
        var res = UrlFetchApp.fetch(url);
        var content = res.getContentText();
        var json = JSON.parse(content);
    
    
      var count =0 ;
      var count_tow =0 ;
    
    
      if (json.paging.TotalPages===1){
     for (var i=0; i<firstCall(1,start).length; i++) {
      if(firstCall(1,start)[i].state == 7){
      for (var j=0; j<firstCall(1,start)[i].orderItems.length; j++) {
        var node3=firstCall(1,start)[i].orderItems[j].product.sku;
    
    
     if ((node3 == sKu)) {
         
       
     count++;
    
     } 
       
     }
     
     
      }
      
     }
     return count;
        
      
    
    
      
     
    
    
      }
     else  if (json.paging.TotalPages>1)
                    {
                      console.log("2 page");
    var d=0;
    for (var x = 0, ln = json.paging.TotalPages; x < ln; x++) {
    
    
    
      d++;
      if(d<=json.paging.TotalPages){
    
                                               
                     
        for (var i=0; i<firstCall(d,start).length; i++) {
       
      
      if(firstCall(d,start)[i].state == 7){
      for (var j=0; j<firstCall(d,start)[i].orderItems.length; j++) {
        var node3=firstCall(d,start)[i].orderItems[j].product.sku;
    
      
    
     if ((node3 == sKu)) {
            
       
      count_tow++;
    
       
       
     }
     
     
      }
       
     
    
        
      }
      
      }
    
      }
     }
        return count_tow;
      }
      }
      catch(err){
          return "Error getting data" + err;
      }
    }
    

Error messages keep saying "Exceeded maximum execution time (line 0)."

Could anyone help? Thank you a lot!

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