Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion src/Client/Grpc/GrpcDurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,12 @@ public override async Task<IList<HistoryEvent>> GetOrchestrationHistoryAsync(
using AsyncServerStreamingCall<P.HistoryChunk> streamResponse =
this.sidecarClient.StreamInstanceHistory(streamRequest, cancellationToken: cancellation);

Microsoft.DurableTask.ProtoUtils.EntityConversionState entityConversionState = new(insertMissingEntityUnlocks: false);

List<HistoryEvent> pastEvents = [];
while (await streamResponse.ResponseStream.MoveNext(cancellation))
{
pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(DurableTask.ProtoUtils.ConvertHistoryEvent));
pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(entityConversionState.ConvertFromProto));
}

return pastEvents;
Expand Down
8 changes: 6 additions & 2 deletions src/Worker/Grpc/GrpcOrchestrationRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ public static string LoadAndRun(
P.OrchestratorRequest request = P.OrchestratorRequest.Parser.Base64Decode<P.OrchestratorRequest>(
encodedOrchestratorRequest);

List<HistoryEvent> pastEvents = request.PastEvents.Select(ProtoUtils.ConvertHistoryEvent).ToList();
IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(ProtoUtils.ConvertHistoryEvent);
ProtoUtils.EntityConversionState entityConversionState = new(insertMissingEntityUnlocks: false);
Copy link
Member

Choose a reason for hiding this comment

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

dont we need instanceid specified here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The orchestration instance ID is automatically set when the ExecutionStarted event is processed during history conversion (see ProtoUtils.cs line 62: conversionState?.SetOrchestrationInstance(instance)). No manual setting is needed.


Func<P.HistoryEvent, HistoryEvent> converter = entityConversionState.ConvertFromProto;

List<HistoryEvent> pastEvents = request.PastEvents.Select(converter).ToList();
IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(converter);
Dictionary<string, object?> properties = request.Properties.ToDictionary(
pair => pair.Key,
pair => ProtoUtils.ConvertValueToObject(pair.Value));
Expand Down
Loading