Skip to content

Commit 36c3e02

Browse files
committed
sqlcapture: Fix error shutdown edge case
This probably doesn't make a real difference since the only time we might fail to cancel the commit-buffering worker context would be if an error occurred and the connector was shutting down anyway, but we might as well satisfy the static analysis warning.
1 parent a6d3ee0 commit 36c3e02

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sqlcapture/capture.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ func (c *Capture) streamToFence(ctx context.Context, replStream ReplicationStrea
578578
event CommitEvent // When we have a buffered commit event which hasn't yet been processed or invalidated, this is it. Otherwise it's nil.
579579
}
580580
var workerCtx, cancelWorkerCtx = context.WithCancel(ctx) // Context for the commit buffering worker goroutine
581+
defer cancelWorkerCtx() // Ensure that the worker goroutine always exits when we do
581582
var workerGroup errgroup.Group
582583
workerGroup.Go(func() error {
583584
var ticker = time.NewTicker(commitBufferingInterval)

0 commit comments

Comments
 (0)