Skip to content

Commit

Permalink
return early when exit condition has been reached
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Oct 24, 2023
1 parent df876a0 commit b037c67
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flow/connectors/postgres/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ func (p *PostgresCDCSource) consumeStream(

nextStandbyMessageDeadline = time.Now().Add(standbyMessageTimeout)

if !p.commitLock && (len(records.Records) >= int(req.MaxBatchSize)) {
if !p.commitLock {
log.Infof("Stand-by timeout reached, returning currently '%d' records", len(records.Records))
return result, nil
}
}
Expand All @@ -187,7 +188,7 @@ func (p *PostgresCDCSource) consumeStream(
cancel()
if err != nil && !p.commitLock {
if pgconn.Timeout(err) {
log.Infof("Idle timeout reached, returning currently accumulated records")
log.Infof("Idle timeout reached, returning currently accumulated records - %d", len(records.Records))
return result, nil
} else {
return nil, fmt.Errorf("ReceiveMessage failed: %w", err)
Expand Down

0 comments on commit b037c67

Please sign in to comment.