Skip to content

Commit

Permalink
Avoid leaking Progress/SyncFlowStatus/NormalizeFlowStatus prefix (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex authored Feb 23, 2024
1 parent 4bafd25 commit 00fd27d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flow/workflows/cdc_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ func NewCDCFlowWorkflowState(cfg *protos.FlowConnectionConfigs) *CDCFlowWorkflow
// truncate the progress and other arrays to a max of 10 elements
func (s *CDCFlowWorkflowState) TruncateProgress(logger log.Logger) {
if len(s.Progress) > 10 {
s.Progress = s.Progress[len(s.Progress)-10:]
copy(s.Progress, s.Progress[len(s.Progress)-10:])
s.Progress = s.Progress[:10]
}
if len(s.SyncFlowStatuses) > 10 {
s.SyncFlowStatuses = s.SyncFlowStatuses[len(s.SyncFlowStatuses)-10:]
copy(s.SyncFlowStatuses, s.SyncFlowStatuses[len(s.SyncFlowStatuses)-10:])
s.SyncFlowStatuses = s.SyncFlowStatuses[:10]
}
if len(s.NormalizeFlowStatuses) > 10 {
s.NormalizeFlowStatuses = s.NormalizeFlowStatuses[len(s.NormalizeFlowStatuses)-10:]
copy(s.NormalizeFlowStatuses, s.NormalizeFlowStatuses[len(s.NormalizeFlowStatuses)-10:])
s.NormalizeFlowStatuses = s.NormalizeFlowStatuses[:10]
}

if s.SyncFlowErrors != nil {
Expand Down

0 comments on commit 00fd27d

Please sign in to comment.