title: How can I use promises in an infinite loop with delay?
body: <pre><code>require(&quot;./getSongFromSpotify&quot;)().then(a =&gt; {
      require(&quot;./instify&quot;)(a.artist,a.name).then(r =&gt; {
          if (r.status === &quot;ok&quot;){
              console.log(&quot;saved&quot;)
          }else{
              console.log(&quot;Instagram API have a problem!&quot;)
          }
      }).catch((r) =&gt; {console.error(r)})
  }).catch((r) =&gt; {console.error(r)})
  </code></pre>
  <p>I need to execute this code in an infinite loop with 2000ms delay. How can I do this?</p>