I am playing around with Tasks, Async and await in my WorkerRole (RoleEntryPoint).
I had some unexplained recycles and i have found out now that if something is running
I would recommend a lower value for Task.Delay
like 1000 (ms). I suspect that the worker role cannot respond quickly enough to the health check. The role is then considered unresponsive and restarted.
Make sure the Run
method never returns with something like this
while (true)
{
Thread.Sleep(1000);
}
Or with Task.Delay
in your case.