title: how to make a recursive function asyncronous with limited concurrency using PLimit in javascript
body: <p>Basically what im trying to do is a recursive http request that will run in a limited parallel requests for faster execution and get a result using await.</p>
  <pre class="lang-js prettyprint-override"><code>async function sitetree(subsiteurl, subsitetitle) {
  
      var url = &quot;https://xxxxxx.sharepoint.com&quot; + subsiteurl + &quot;/_api/web/webinfos?$select=ServerRelativeUrl,Title&quot;
  
      logtext(subsiteurl + &quot;\n&quot;, sitetree_file)
      sitecount++
      stats()
  
      ajax(url, global_headers, &quot;verbose&quot;).then(function (subsites) {
          requestcount++
          stats()
  
  
          subsites.d.results.forEach(function (data) {
  
              sitetree(data.ServerRelativeUrl, data.Title);
  
          });
  
      }).catch(function (error) {
  
          console.log(error)
  
      })
  
  }
  </code></pre>