Я вижу странное поведение с функциями Azure Durable - при создании новой оркестровки генерируется следующий код, одну строку которого я изменил (см. Комментарий в коде):
[FunctionName("TesterOrchestrator")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationTrigger] DurableOrchestrationContext context)
{
var outputs = new List<string>();
// Replace "hello" with the name of your Durable Activity Function.
outputs.Add(await context.CallActivityAsync<string>("TesterOrchestrator_Hello", "Tokyo"));
outputs.Add(await context.CallActivityAsync<string>("TesterOrchestrator_Hello", "Seattle"));
outputs.Add(await context.CallActivityAsync<string>("TesterOrchestrator_Hello", "London"));
// returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
return outputs;
}
[FunctionName("TesterOrchestrator_Hello")]
public static string SayHello([ActivityTrigger] string name, ILogger log)
{
log.LogInformation($"Saying hello to {name}.");
return $"Hello {name}!";
}
[FunctionName("TesterOrchestrator_HttpStart")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")]HttpRequestMessage req,
[OrchestrationClient]DurableOrchestrationClient starter,
ILogger log)
{
// Function input comes from the request content.
string instanceId = await starter.StartNewAsync("TesterOrchestrator", null);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
// this is the line I have changed - I want the code to return the result
// (if within 10 seconds) and only if it takes longer than that return the URLs for status checking, termination etc
return await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(250));
}
Теперь, учитывая, что код на самом деле ничего не делает , он должен возвращаться почти мгновенно, но я вижу (при запуске запросов к функции запуска), что он колеблется между принятием ~ 1 секунда, чтобы вернуться с сообщениями "привет", занимая несколько секунд (6+) и между возвратом ответа 202 с URL-адресами (то есть, это заняло 10 секунд и было прекращено при возврате ответа).
Что может вызвать задержки?