0

The variable isPlaceAvailable has always the same value as isComplete. It seems as the function monitorContext.CallActivityAsync("GetIsPlaceAvailable", input.Id) isn't even executed.

            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.");
        }
2
  • If you add the log inside GetIsPlaceAvailable function then those are being logged? During debug, are the debug point being hit? Commented May 25, 2021 at 6:13
  • I inserted a log and breakpoint but it just skips the function GetIsPlaceAvailable. Commented May 25, 2021 at 10:45

1 Answer 1

1

It seems as the problem was that the first async call, which was inside the if(!context.isReplaying) {} caused the problem. When calling the function SendConfirmationAlert outside of the while loop it it works as expected.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.