Azure / durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
Apache License 2.0
1.47k stars 287 forks source link

the await Task.Delay will make the ScheduleTask not execute in the second time and hang? #1056

Closed AiHaibara closed 3 months ago

AiHaibara commented 3 months ago
while (status != "succeeded")
{
    status = await context.ScheduleTask<string>(typeof(CheckTaskStatusActivity), taskId);
    if (status != "succeeded")
    {
        await Task.Delay(3000);
        //Thread.Sleep(3000);
    }
}

Thread.Sleep(3000); will working normally, but await Task.Delay(3000); will make it hang.

cgillum commented 3 months ago

This is expected. Awaiting a non-durable task will cause your orchestration to hang. You should instead use await context.CreateTimer(…). Check the wiki for more information and examples.

AiHaibara commented 3 months ago

This is expected. Awaiting a non-durable task will cause your orchestration to hang. You should instead use await context.CreateTimer(…). Check the wiki for more information and examples.

Ok, Thanks for share this.