Skip to content

Commit 041ee48

Browse files
committed
further optimization
1 parent 112b099 commit 041ee48

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/services/dispatcher/server_v1.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,11 @@ func (s *DispatcherImpl) subscribeToWorkflowRunsV1(server contracts.Dispatcher_S
400400

401401
events, err := s.taskEventsToWorkflowRunEvent(tenantId, finalizedWorkflowRuns)
402402

403+
// Release the reference to finalizedWorkflowRuns so GC can reclaim the large
404+
// payload byte slices while we're sending events (which can be slow due to
405+
// sendMu serialization). The event data has already been copied to strings.
406+
finalizedWorkflowRuns = nil
407+
403408
if err != nil {
404409
s.l.Error().Err(err).Msg("could not convert task events to workflow run events")
405410
return err

0 commit comments

Comments
 (0)