Skip to content

Commit

Permalink
Use NewNonRetryableApplicationError when replState mismatch occurs (#…
Browse files Browse the repository at this point in the history
…1374)

Otherwise activity retries & continually hits same error
  • Loading branch information
serprex authored Feb 25, 2024
1 parent d614837 commit a989cab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion flow/connectors/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/jackc/pgx/v5/pgtype"
"github.com/jackc/pgx/v5/pgxpool"
"go.temporal.io/sdk/log"
"go.temporal.io/sdk/temporal"

"github.com/PeerDB-io/peer-flow/connectors/utils"
"github.com/PeerDB-io/peer-flow/connectors/utils/monitoring"
Expand Down Expand Up @@ -149,7 +150,7 @@ func (c *PostgresConnector) MaybeStartReplication(
c.replState.Slot, slotName, c.replState.Publication, publicationName, c.replState.Offset, req.LastOffset,
)
c.logger.Info(msg)
return errors.New(msg)
return temporal.NewNonRetryableApplicationError(msg, "desync", nil)
}

if c.replState == nil {
Expand Down
2 changes: 0 additions & 2 deletions flow/workflows/cdc_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,7 @@ func CDCFlowWorkflowWithConfig(
totalRecordsSynced += childSyncFlowRes.NumRecordsSynced
w.logger.Info("Total records synced: ",
slog.Int64("totalRecordsSynced", totalRecordsSynced))
}

if childSyncFlowRes != nil {
tableSchemaDeltasCount := len(childSyncFlowRes.TableSchemaDeltas)

// slightly hacky: table schema mapping is cached, so we need to manually update it if schema changes.
Expand Down

0 comments on commit a989cab

Please sign in to comment.