title: Should I use Thread.Sleep or Task.Delay in a nopcommerce Task?
body: <p>I am coding a Task in a plugin to nopcommerce. The Task must download a catalogue from a website (<a href="https://data.icecat.biz/export/level4/" rel="nofollow">https://data.icecat.biz/export/level4/</a>). If the download fail for some reason, I want my program to wait for a minute and then try again a couple of times.</p>
  
  <p>e.g</p>
  
  <pre><code>while(notTiredOfWaiting)
  {
     try{
        // my download stuff here
        return data;
     }
     catch(Exception e)
     {
        Thread.Sleep(60000);
         // or
        Task.Delay(60000);
     }
  }
  </code></pre>
  
  <p>My problem is that nopcommerce is some kind of blackbox, which starts and run my task. The "easy" solution is to use Thread.Sleep(), but I don't know if any other important processes runs on the same thread. I have tried Task.Delay(), but it doesn't seem to work in my implementation.</p>
  
  <p>I known that Thread.Sleep versus Task.Delay() is a hot topic on SO, but I am asking for a specific answer for what is best practice in nopCommerce.</p>
  
  <p>Edit.</p>
  
  <p>The task is using IScheduleTaskService.</p>