Skip to content

Commit

Permalink
Fix Negative Requeue Duration in getStatusCheckDelay of DRPlacementCo…
Browse files Browse the repository at this point in the history
…ntrol Reconciler

Signed-off-by: Oded Viner <[email protected]>
  • Loading branch information
OdedViner committed Feb 18, 2025
1 parent e2d4809 commit 78b3af6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions internal/controller/drplacementcontrol_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,18 +1246,17 @@ func (r *DRPlacementControlReconciler) getStatusCheckDelay(
beforeProcessing metav1.Time, afterProcessing metav1.Time,
) time.Duration {
if beforeProcessing != afterProcessing {
// DRPC's VRG status update processing time has changed during this
// iteration of the reconcile loop. Hence, the next attempt to update
// the status should be after a delay of a standard polling interval
// duration.
// Processing time changed: return the full delay.
return StatusCheckDelay
}

// DRPC's VRG status update processing time has NOT changed during this
// iteration of the reconcile loop. Hence, the next attempt to update the
// status should be after the remaining duration of this polling interval has
// elapsed: (beforeProcessing + StatusCheckDelay - time.Now())
return time.Until(beforeProcessing.Add(StatusCheckDelay))
// Calculate the remaining time until the next scheduled update.
remaining := time.Until(beforeProcessing.Add(StatusCheckDelay))
if remaining < 0 {
// If the scheduled time is already in the past, requeue immediately.
return 0
}
return remaining
}

// updateDRPCStatus updates the DRPC sub-resource status with,
Expand Down

0 comments on commit 78b3af6

Please sign in to comment.