Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix race condition on OrchestrationRuntimeState.NewEvents #380

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ Task IOrchestrationService.CompleteTaskOrchestrationWorkItemAsync(
InstanceId = workItem.InstanceId,
BatchStartPosition = messageBatch.BatchStartPosition,
BatchLength = messageBatch.BatchLength,
NewEvents = (List<HistoryEvent>)newOrchestrationRuntimeState.NewEvents,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can (or should) statically enforce that NewEvents should be readonly. That way, we can have more confidence that it is immutable. Is that worth it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of an easy (and standard) way to statically enforce this. I think there is a library for immutable collections but I don't really think it is worth the hassle.

NewEvents = newOrchestrationRuntimeState.NewEvents.ToList(),
sebastianburckhardt marked this conversation as resolved.
Show resolved Hide resolved
WorkItemForReuse = cacheWorkItemForReuse ? orchestrationWorkItem : null,
PackPartitionTaskMessages = partition.Settings.PackPartitionTaskMessages,
PersistFirst = partition.Settings.PersistStepsFirst ? BatchProcessed.PersistFirstStatus.Required : BatchProcessed.PersistFirstStatus.NotRequired,
Expand Down