Skip to content

Commit

Permalink
gracefully handle errors for get last sync id
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 7, 2024
1 parent 95eecaa commit e14b538
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flow/workflows/cdc_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,11 @@ func CDCFlowWorkflowWithConfig(
lastSyncFuture := workflow.ExecuteLocalActivity(syncMetaCtx, flowable.GetLastSyncedID, lastSyncInput)
var dstSyncState *protos.LastSyncState
if err := lastSyncFuture.Get(syncMetaCtx, &dstSyncState); err != nil {
// SYNC ERROR ONLY
return nil, fmt.Errorf("failed to get last synced ID from destination peer: %w", err)
if ctx.Err() == nil {
w.logger.Error("failed to get last synced ID from destination peer", "error", err)
_ = workflow.Sleep(ctx, time.Second)
}
continue
}
if dstSyncState != nil {
w.logger.Info(fmt.Sprintf("last synced ID from destination peer - %d", dstSyncState.Checkpoint))
Expand Down

0 comments on commit e14b538

Please sign in to comment.