I want to insert infos from JIRA to a Sql Server, The JIRA server restrict me on the number of request I send in parallel so I have to dilute the number of call I can send in the same time.
I did it this way first and it works :
    mainJira.getAllPendingIssue(totalIssues).then(function(issues){
      var pendingTicket = mainJira.pop_to_array(issues)
      JiraToSql(pendingTicket,0,100)
      .then(
        JiraToSql(pendingTicket,100,200))
      .then(
        JiraToSql(pendingTicket,200,300))
    })
But as the number of issues may vary, I would like to do it in a loop. I tried this way but it doesn't work
      mainJira.getAllPendingIssue(totalIssues).then(function(issues){
        var pendingTicket = mainJira.pop_to_array(issues)
        for (pas = 0; pas < totalIssues; pas+= 50 ){
          console.log('pas : ',pas );        
          JiraToSql(pendingTicket,pas,pas + 50);
          } 
        })    
      })
 
    