Azure functions CallActivityAsync不同函数的值相同
变量IsReplaceAvailable的值始终与isComplete的值相同。看起来函数monitorContext.CallActivityAsync(“getispReplaceAvable”,input.Id)甚至没有执行Azure functions CallActivityAsync不同函数的值相同,azure-functions,azure-durable-functions,Azure Functions,Azure Durable Functions,变量IsReplaceAvailable的值始终与isComplete的值相同。看起来函数monitorContext.CallActivityAsync(“getispReplaceAvable”,input.Id)甚至没有执行 while (monitorContext.CurrentUtcDateTime < endTime) { // Check the weather
while (monitorContext.CurrentUtcDateTime < endTime)
{
// Check the weather
if (!monitorContext.IsReplaying)
{
bool isComplete = await monitorContext.CallActivityAsync<bool>("SendConfirmationAlert", msg);
log.LogInformation($"Checking current course conditions for {input.Id} at {monitorContext.CurrentUtcDateTime}.");
}
bool isPlaceAvailable = await monitorContext.CallActivityAsync<bool>("GetIsPlaceAvailable", input.Id);
if (isPlaceAvailable)
{
// It's not raining! Or snowing. Or misting. Tell our user to take advantage of it.
if (!monitorContext.IsReplaying)
{
log.LogInformation($"Detected place available for {input.Id}. Notifying {input.Phone}.");
}
await monitorContext.CallActivityAsync("SendPlaceAvailableAlert", msg);
break;
}
else
{
// Wait for the next checkpoint
var interval = await monitorContext.CallActivityAsync<int>("GetInterval", null);
var nextCheckpoint = monitorContext.CurrentUtcDateTime.AddMinutes(interval);
if (!monitorContext.IsReplaying) { log.LogInformation($"Next check for {input.Id} at {nextCheckpoint}."); }
await monitorContext.CreateTimer(nextCheckpoint, CancellationToken.None);
}
}
log.LogInformation($"Monitor expiring.");
}
while(monitorContext.CurrentUtcDateTime
问题似乎是第一个异步调用(位于if(!context.isReplaying){}
中)导致了问题。在while循环之外调用函数SendConfirmationAlert
时,它会按预期工作。如果在getispReplaceAble
函数中添加日志,那么这些日志是否正在被记录?在调试过程中,是否命中调试点?我插入了一个日志和断点,但它只是跳过了函数GetIsReplaceAble。