title: Recursively checking the status of a job on GitLab with Axios
body: <p>I'm trying to get the job logs of a job that has a specific status (successful). I've decided to go with recursion but I keep reaching a read time out after a certain amount of time :</p>
  <pre><code>//Trigger pipelines
      await axios.post(`https://gitlab.com/api/v4/projects/${PROJECT_ID_CREATE}/trigger/pipeline?token=${CREATE_TOKEN}&amp;ref=terraform-v1-mirror`)
          .then(async (gitlabPOSTRequest) =&gt; {
                  pipelineId = gitlabPOSTRequest.data.id
                  console.log(`pipeline_id = ${pipelineId}`)
              }, (error) =&gt; {
                  console.log(error)
              }
          )
  
      let config = {
          method: 'GET',
          url: `https://gitlab.com/api/v4/projects/${PROJECT_ID_CREATE}/pipelines/${pipelineId}/jobs?scope[]=success`,
          headers: {
              &quot;PRIVATE-TOKEN&quot;: PRIVATE_TOKEN
          }
      }
      //Get Job Id
      await axios(config)
          .then(async (gitlabGETRequest) =&gt; {
                  for (let gitLabResponse in gitlabGETRequest){
                      if(JSON.stringify(gitLabResponse.data.name)=='apply'){
                          jobId = JSON.stringify(gitLabResponse.data.id)
                      }else {
                          await axios(config)
                      }
                  }
                  console.log(`Job id : ${JSON.stringify(gitlabGETRequest.data[2].id)}`)
              }, (error) =&gt; {
                  console.log(error)
              }
          )
  </code></pre>
  <p>Am I doing it the right way? Is it the several GET requests that are pissing off the GitLab server?</p>