Skip to content

Commit

Permalink
aded default requeue constant
Browse files Browse the repository at this point in the history
  • Loading branch information
lubedacht committed Jan 15, 2024
1 parent ce06e61 commit 11f51a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/controller/ionoscloudmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (r *IonosCloudMachineReconciler) reconcileNormal(machineScope *scope.Machin
// Ensure that a LAN is created in the datacenter
if requeue, err := cloudService.ReconcileLAN(); err != nil || requeue {
if requeue {
return ctrl.Result{RequeueAfter: time.Second * 30}, err
return ctrl.Result{RequeueAfter: defaultReconcileDuration}, err
}
return ctrl.Result{}, fmt.Errorf("could not reconcile LAN %w", err)
}
Expand All @@ -211,8 +211,13 @@ func (r *IonosCloudMachineReconciler) reconcileDelete(cloudService *cloud.Servic
if err != nil {
return ctrl.Result{}, fmt.Errorf("could not reconcile LAN deletion: %w", err)
}

var after time.Duration
if requeue {
after = defaultReconcileDuration
}
return ctrl.Result{
Requeue: requeue,
RequeueAfter: after,
}, nil
}

Expand Down
7 changes: 7 additions & 0 deletions internal/controller/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package controller

import "time"

const (
defaultReconcileDuration = time.Second * 20
)

0 comments on commit 11f51a1

Please sign in to comment.