Skip to content

Commit

Permalink
refactor start time update
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Dec 5, 2023
1 parent 69621f8 commit ca539d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func (a *FlowableActivity) replicateQRepPartition(ctx context.Context,
partition *protos.QRepPartition,
runUUID string,
) error {
err := a.CatalogMirrorMonitor.UpdateStartTimeForPartition(ctx, runUUID, partition, nil)
err := a.CatalogMirrorMonitor.UpdateStartTimeForPartition(ctx, runUUID, partition, time.Now())
if err != nil {
return fmt.Errorf("failed to update start time for partition: %w", err)
}
Expand Down Expand Up @@ -900,7 +900,7 @@ func (a *FlowableActivity) ReplicateXminPartition(ctx context.Context,
return updateErr
}

err := a.CatalogMirrorMonitor.UpdateStartTimeForPartition(ctx, runUUID, partition, &startTime)
err := a.CatalogMirrorMonitor.UpdateStartTimeForPartition(ctx, runUUID, partition, startTime)
if err != nil {
return fmt.Errorf("failed to update start time for partition: %w", err)
}
Expand Down
6 changes: 1 addition & 5 deletions flow/connectors/utils/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,11 @@ func (c *CatalogMirrorMonitor) UpdateStartTimeForPartition(
ctx context.Context,
runUUID string,
partition *protos.QRepPartition,
overrideStartTime *time.Time,
startTime time.Time,
) error {
if c == nil || c.catalogConn == nil {
return nil
}
startTime := time.Now()
if overrideStartTime != nil {
startTime = *overrideStartTime
}

_, err := c.catalogConn.Exec(ctx, `UPDATE peerdb_stats.qrep_partitions SET start_time=$1
WHERE run_uuid=$2 AND partition_uuid=$3`, startTime, runUUID, partition.PartitionId)
Expand Down

0 comments on commit ca539d8

Please sign in to comment.