Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 8c3dc7a

Browse files
committed
Fix time constants
1 parent 76c8694 commit 8c3dc7a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/controller/runner.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package controller
1818

1919
import (
2020
"context"
21-
"time"
2221

2322
v1 "k8s.io/api/core/v1"
2423
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -55,7 +54,7 @@ func (r *Runner) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result,
5554
// delete wrapped resources
5655
if r.deleteResources(ctx, appWrapper) != 0 {
5756
// requeue reconciliation
58-
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
57+
return ctrl.Result{RequeueAfter: deletionDelay}, nil
5958
}
6059
// set empty status
6160
return r.updateStatus(ctx, appWrapper, mcadv1beta1.Empty)
@@ -87,7 +86,7 @@ func (r *Runner) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result,
8786
if r.deleteResources(ctx, appWrapper) != 0 {
8887
if !isSlowRequeuing(appWrapper) {
8988
// requeue reconciliation
90-
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
89+
return ctrl.Result{RequeueAfter: deletionDelay}, nil
9190
}
9291
r.forceDelete(ctx, appWrapper)
9392
}
@@ -197,5 +196,5 @@ func isSlowRunning(appWrapper *mcadv1beta1.AppWrapper) bool {
197196

198197
// Is requeuing too slow?
199198
func isSlowRequeuing(appWrapper *mcadv1beta1.AppWrapper) bool {
200-
return metav1.Now().After(appWrapper.Status.RunnerStatus.LastRequeuingTime.Add(time.Minute))
199+
return metav1.Now().After(appWrapper.Status.RunnerStatus.LastRequeuingTime.Add(requeuingTimeout))
201200
}

internal/controller/timings.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const (
3030
clusterInfoTimeout = time.Minute // how often to refresh cluster capacity
3131

3232
// RequeueAfter delays
33-
runDelay = time.Minute // how often to force check running AppWrapper health
34-
dispatchDelay = time.Minute // how often to force dispatch
33+
runDelay = time.Minute // how often to force check running AppWrapper health
34+
dispatchDelay = time.Minute // how often to force dispatch
35+
deletionDelay = 5 * time.Second // how often to check deleted resources
3536
)

0 commit comments

Comments
 (0)