Skip to content

Commit

Permalink
cancel pull context when we have already synced a partition
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Dec 11, 2023
1 parent 73cbb66 commit 4c3bae3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ func (a *FlowableActivity) replicateQRepPartition(ctx context.Context,
return fmt.Errorf("failed to update start time for partition: %w", err)
}

srcConn, err := connectors.GetQRepPullConnector(ctx, config.SourcePeer)
pullCtx, pullCancel := context.WithCancel(ctx)
srcConn, err := connectors.GetQRepPullConnector(pullCtx, config.SourcePeer)
if err != nil {
return fmt.Errorf("failed to get qrep source connector: %w", err)
}
Expand Down Expand Up @@ -632,6 +633,7 @@ func (a *FlowableActivity) replicateQRepPartition(ctx context.Context,
}

if res == 0 {
pullCancel()
log.WithFields(log.Fields{
"flowName": config.FlowJobName,
}).Infof("no records to push for partition %s\n", partition.PartitionId)
Expand Down

0 comments on commit 4c3bae3

Please sign in to comment.