Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errgroup: return context.Canceled instead of using another context #1410

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,7 @@ func (a *FlowableActivity) replicateQRepPartition(ctx context.Context,
var rowsSynced int
bufferSize := shared.FetchAndChannelSize
if config.SourcePeer.Type == protos.DBType_POSTGRES {
taskCtx, taskCancel := context.WithCancel(ctx)
errGroup, errCtx := errgroup.WithContext(taskCtx)
errGroup, errCtx := errgroup.WithContext(ctx)
stream := model.NewQRecordStream(bufferSize)
errGroup.Go(func() error {
pgConn := srcConn.(*connpostgres.PostgresConnector)
Expand All @@ -666,8 +665,7 @@ func (a *FlowableActivity) replicateQRepPartition(ctx context.Context,
a.Alerter.LogFlowError(ctx, config.FlowJobName, err)
return fmt.Errorf("failed to sync records: %w", err)
}
taskCancel()
return nil
return context.Canceled
})

err = errGroup.Wait()
Expand Down
Loading