[Question] Necessary to check IsReplaying before SetCustomStatus? #1764
-
QuestionIs it necessary to check if an orchestration function is replaying before setting a custom status? For example: if (!functionContext.IsReplaying)
functionContext.SetCustomStatus("Creating Project");
var _ = await functionContext
.CallActivityAsync<Guid>(nameof(CreateProjectActivity), project);
if (!functionContext.IsReplaying)
functionContext.SetCustomStatus("Creating Project Users");
var _ = await functionContext
.CallActivityAsync<Guid>(nameof(CreateProjectUsersActivity), project);
functionContext.SetCustomStatus("Project Created"); Or is this handled automatically? I'd assume replays are fast, but I'm not sure how long it takes for the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It's not necessary to check for The Does that help clarify? |
Beta Was this translation helpful? Give feedback.
-
Yep makes sense. Thanks @cgillum |
Beta Was this translation helpful? Give feedback.
It's not necessary to check for
IsReplaying
.The
SetCustomStatus
API doesn't actually do any I/O at the time you call it. Rather, it just updates some in-memory state. The I/O happens at the point where we checkpoint the updated instance history (usually the nextawait
statement). Only the data saved in the lastSetCustomStatus
call will get persisted. This also means that you'll never see a "Creating Project" status when querying the instance status, even if the query happens mid-replay.Does that help clarify?