Skip to content

Commit ec438e2

Browse files
committed
cleanup
1 parent e714af0 commit ec438e2

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

flow/connectors/mysql/cdc.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ func (c *MySqlConnector) PullRecords(
367367
}
368368
if recordCount == 1 {
369369
req.RecordStream.SignalAsNotEmpty()
370+
if cancelTimeout != nil {
371+
cancelTimeout()
372+
}
370373
timeoutCtx, cancelTimeout = context.WithTimeout(ctx, req.IdleTimeout)
371374
}
372375
return nil
@@ -386,9 +389,10 @@ func (c *MySqlConnector) PullRecords(
386389
c.logger.Info("[mysql] timeout reached, but still in transaction, waiting for inTx false",
387390
slog.Uint64("recordCount", uint64(recordCount)))
388391
// reset timeoutCtx to a low value and wait for inTx to become false
389-
// cancelTimeout should be called by defer, spurious lint
390-
cancelTimeout()
391-
//nolint:govet
392+
if cancelTimeout != nil {
393+
cancelTimeout()
394+
}
395+
//nolint:govet // cancelTimeout called by defer, spurious lint
392396
timeoutCtx, cancelTimeout = context.WithTimeout(ctx, 10*time.Second)
393397
overtime = true
394398
} else {
@@ -411,6 +415,7 @@ func (c *MySqlConnector) PullRecords(
411415
return nil
412416
}
413417
// if in tx, don't let syncer exit due to deadline exceeded
418+
continue
414419
} else {
415420
if errors.Is(err, context.Canceled) {
416421
c.logger.Info("[mysql] PullRecords context canceled, stopping streaming", slog.Any("error", err))

0 commit comments

Comments
 (0)