Skip to content

Commit

Permalink
fix minor cdc issue (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Oct 26, 2023
1 parent c060dd8 commit f8d2f23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion flow/connectors/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
log "github.com/sirupsen/logrus"

connbigquery "github.com/PeerDB-io/peer-flow/connectors/bigquery"
conneventhub "github.com/PeerDB-io/peer-flow/connectors/eventhub"
Expand Down Expand Up @@ -254,5 +255,8 @@ func CloseConnector(conn Connector) {
return
}

conn.Close()
err := conn.Close()
if err != nil {
log.Errorf("error closing connector: %v", err)
}
}
4 changes: 2 additions & 2 deletions flow/connectors/postgres/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ func (p *PostgresCDCSource) consumeStream(
shutdown <- true
}()

firstProcessed := false

for {
if time.Now().After(nextStandbyMessageDeadline) ||
(len(records.Records) >= int(req.MaxBatchSize)) {
Expand Down Expand Up @@ -214,8 +216,6 @@ func (p *PostgresCDCSource) consumeStream(
continue
}

firstProcessed := false

switch msg.Data[0] {
case pglogrepl.PrimaryKeepaliveMessageByteID:
pkm, err := pglogrepl.ParsePrimaryKeepaliveMessage(msg.Data[1:])
Expand Down

0 comments on commit f8d2f23

Please sign in to comment.