Skip to content

Commit

Permalink
set no deadline for the first message
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Nov 16, 2023
1 parent 636118d commit 30f0efa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion flow/connectors/postgres/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,17 @@ func (p *PostgresCDCSource) consumeStream(
}
}

ctx, cancel := context.WithDeadline(p.ctx, nextStandbyMessageDeadline)
var ctx context.Context
var cancel context.CancelFunc

if len(localRecords) == 0 {
// if length of localRecords is 0, then we are waiting for the first record
// indefinitely. So we should not timeout.
ctx, cancel = context.WithCancel(p.ctx)
} else {
ctx, cancel = context.WithDeadline(p.ctx, nextStandbyMessageDeadline)
}

rawMsg, err := conn.ReceiveMessage(ctx)
cancel()
if err != nil && !p.commitLock {
Expand Down

0 comments on commit 30f0efa

Please sign in to comment.