Skip to content

Commit

Permalink
Improve exception logging, set input data to null after it is parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
boma96 committed Jan 25, 2024
1 parent fb98a21 commit 421dc94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ConductorSharp.Engine/ExecutionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConductorSharpExecutionContext>();
Expand All @@ -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
Expand Down

0 comments on commit 421dc94

Please sign in to comment.