Async/await in azure worker role causing the role to recycle

前端 未结 2 627
情话喂你
情话喂你 2021-02-13 17:08

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

2条回答
  •  抹茶落季
    2021-02-13 17:45

    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.

提交回复
热议问题