Является ли следующая структура if
- else
слишком неопределенной c для оркестровки Azure Durable Functions?:
[FunctionName(FUNC_NAME_ORCH0)]
public static async Task<string> RunPlayerYouTubeOrchestration(
[OrchestrationTrigger] DurableOrchestrationContext orchestrationContext,
ILogger log)
{
if (!orchestrationContext.IsReplaying)
log?.LogInformation(GetInvocationMessage(orchestrationContext, FUNC_NAME_ORCH0));
var hasExhaustedPartitions = await orchestrationContext
.CallActivityAsync<bool>(FUNC_NAME_ORCH_FUNC0, null);
if (!hasExhaustedPartitions)
{
var jsonBlobs = await orchestrationContext
.CallActivityAsync<string[]>(FUNC_NAME_ORCH_FUNC1, null);
var tasks = new Task[jsonBlobs.Length];
for (int i = 0; i < jsonBlobs.Length; i++)
{
var json = jsonBlobs[i];
tasks[i] = orchestrationContext.CallActivityAsync(FUNC_NAME_ORCH_FUNC2, json);
}
if (!orchestrationContext.IsReplaying)
log?.LogInformation($"{FUNC_NAME_ORCH0}: fan-out starting...");
await Task.WhenAll(tasks);
}
else
{
var orc1InstanceId = await orchestrationContext
.CallSubOrchestratorAsync<string>(FUNC_NAME_ORCH1, null);
if (!orchestrationContext.IsReplaying)
log?.LogInformation($"{FUNC_NAME_ORCH1} completed with instance ID `{orc1InstanceId}`.");
var orc2InstanceId = await orchestrationContext
.CallSubOrchestratorAsync<string>(FUNC_NAME_ORCH2, null);
if (!orchestrationContext.IsReplaying)
log?.LogInformation($"{FUNC_NAME_ORCH2} completed with instance ID `{orc2InstanceId}`.");
if (!orchestrationContext.IsReplaying)
log?.LogInformation($"{FUNC_NAME_ORCH_FUNC3}: calling `{PlayerYouTubeIndicesActivity.ProcedureNameResetYouTubePartitionInfoAsync}`...");
await orchestrationContext
.CallActivityAsync(FUNC_NAME_ORCH_FUNC3,
PlayerYouTubeIndicesActivity.GetInput(
PlayerYouTubeIndicesActivity.ProcedureNameResetYouTubePartitionInfoAsync));
}
return orchestrationContext.InstanceId;
}
Будет ли hasExhaustedPartitions
плохо работать с воспроизведением? Когда да, что должно быть сделано вместо этого?