title: Parallelize tasks using polly
body: <p>Let's say I have a list of objects <code>myObjs</code> of type <code>List&lt;Foo&gt;</code>.</p>
  <p>I have a polly policy :</p>
  <pre><code>var policy = Policy.Handle&lt;Exception&gt;().RetryForever();
  </code></pre>
  <p>which i want to run methods on in parralel, but keep retrying each as they fail.</p>
  <pre><code>for (int i = 0; i &lt; myObjs.Count; i++)
  {
    var obj = myObjs[i];
    policy.Execute(() =&gt; Task.Factory.StartNew(() =&gt; obj.Do(), TaskCreationOptions.LongRunning));
  }
  </code></pre>
  <p>Will this be called in parallel and retry each obj? So if <code>myObjs[5].do()</code> fails, will only that get retried while other objects just get executed once?</p>
  <p>Also, am I supposed to use the <code>ExecuteAsync()</code> method which accepts <code>Func&lt;Task&gt;</code> instead of the <code>Execute(Action)</code> one as shown in the example? <code>Do()</code> is just a synchronous method, being launched in a separate thread.
  Actual code looks like this where <code>each()</code> is just a foreach <code>wrapper()</code></p>
  <pre><code>_consumers.ForEach(c =&gt; policy.Execute(() =&gt; Task.Factory.StartNew(() =&gt; c.Consume(startFromBeg), TaskCreationOptions.LongRunning)));
  </code></pre>
  <p>EDIT:</p>
  <p>I tried the code:</p>
  <pre><code>class Foo    
  {
          private int _i;
          public Foo(int i)
          {
              _i = i;
          }
          public void Do()
          {
              //var rnd = new Random();
              if (_i==2)
              {
                  Console.WriteLine(&quot;err&quot;+_i);
  
                  throw new Exception();
              }
              Console.WriteLine(_i);
          }
  }
  var policy = Policy.Handle&lt;Exception&gt;().Retry(3);
  var foos=Enumerable.Range(0, 5).Select(x =&gt; new Foo(x)).ToList();
  foos.ForEach(c =&gt; policy.Execute(() =&gt; Task.Factory.StartNew(() =&gt; c.Do(), TaskCreationOptions.LongRunning)));
  </code></pre>
  <p>but am getting result:</p>
  <blockquote>
  <p>0 1 err2 3 4 5</p>
  </blockquote>
  <p>I thought it would retry 2 a few more times, but doesn't. Any idea why?</p>