Closed twosatnams closed 1 year ago
The problem might be related to your use of .Result
for this async API in your calling code. In certain environments, calling .Result
on a task can result in deadlocks. This is more a .NET thing and not so much a behavior of this particular API.
Try instead rewriting it to look like this:
public async Task<bool> IsAlreadyEnqueuedAsync(string instanceId)
{
_logger.LogInformation("Checking if {} is already enqueued", instanceId);
var result = await _taskHubClient.GetOrchestrationStateAsync(instanceId, false);
bool state = result != null;
_logger.LogInformation("{} is already enqueued?: {}", instanceId, state);
return state;
}
Thanks @cgillum, I tried that solution you suggested and it all works as expected now. Closing
Initialization
Calling Code
Expected Behavior
The call should return a list of orchestration states for the most current execution.
Actual Behavior
The function never returns. I see the log statement before
GetOrchestrationStateAsync
gets printed. And another log statement that DTF prints. But the result is never returned, and then it waits infinitely. This behavior remains the same regardless of whether I try with aninstanceId
that I know has enqueued in the past or a new random one that I know has never been scheduled.Environment
OS: macOS Big Sur DTF Version: 2.14.0 Persistence: AzureStorage
Other Notes
CreateOrchestrationInstanceAsync
works fine, so it's probably not an access issue local to my setup