diff --git a/src/ConductorSharp.Engine/ExecutionManager.cs b/src/ConductorSharp.Engine/ExecutionManager.cs index 61d4a197..1db730d8 100644 --- a/src/ConductorSharp.Engine/ExecutionManager.cs +++ b/src/ConductorSharp.Engine/ExecutionManager.cs @@ -118,6 +118,10 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken var inputType = GetInputType(scheduledWorker.TaskType); var inputData = pollResponse.InputData.ToObject(inputType, ConductorConstants.IoJsonSerializer); + // Poll response data can be huge (if read from external storage) + // We can save memory by not holding reference to pollResponse.InputData after it is parsed + pollResponse.InputData = null; + using var scope = _lifetimeScope.BeginLifetimeScope(); var context = scope.ResolveOptional(); @@ -141,8 +145,8 @@ private async Task PollAndHandle(TaskToWorker scheduledWorker, CancellationToken catch (Exception exception) { _logger.LogError( - "{error} while executing {task} as part of {workflow} with id {workflowId}", - exception.Message, + "{@Exception} while executing {Task} as part of {Workflow} with id {WorkflowId}", + exception, pollResponse.TaskDefName, pollResponse.WorkflowType, pollResponse.WorkflowInstanceId