Skip to content

Commit

Permalink
Update end time for batches where end time is not set (#2260)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Nov 15, 2024
1 parent 593093e commit 27996db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flow/connectors/utils/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ func UpdateEndTimeForCDCBatch(
batchID int64,
) error {
_, err := pool.Exec(ctx,
"UPDATE peerdb_stats.cdc_batches SET end_time=$1 WHERE flow_name=$2 AND batch_id=$3",
time.Now(), flowJobName, batchID)
`UPDATE peerdb_stats.cdc_batches
SET end_time = COALESCE(end_time, NOW())
WHERE flow_name = $1 AND batch_id <= $2`,
flowJobName, batchID)
if err != nil {
return fmt.Errorf("error while updating batch in cdc_batch: %w", err)
}
Expand Down

0 comments on commit 27996db

Please sign in to comment.