Skip to content

Commit

Permalink
Fixup: allow FLEET_CLUSTER_ENQUEUE_DELAY to be specified as a duration
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Moioli <[email protected]>
  • Loading branch information
moio committed Nov 4, 2022
1 parent 8d1ce20 commit 5955e5e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/controllers/cluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"os"
"sort"
"strconv"
"time"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -186,13 +185,13 @@ func (h *handler) OnClusterChanged(cluster *fleet.Cluster, status fleet.ClusterS
cluster.Namespace, cluster.Name, status.ResourceCounts.Ready, status.ResourceCounts.DesiredReady)

// Counts from gitrepo are out of sync with bundleDeployment state
// just retry in 15 seconds as there no great way to trigger an event that
// just retry in a number of seconds as there no great way to trigger an event that
// doesn't cause a loop
clusterEnqueueDelay := durations.DefaultClusterEnqueueDelay
if ced, err := strconv.Atoi(os.Getenv("FLEET_CLUSTER_ENQUEUE_DELAY_SECONDS")); err == nil {
clusterEnqueueDelay = time.Duration(ced) * time.Second
delay := durations.DefaultClusterEnqueueDelay
if customDelay, err := time.ParseDuration(os.Getenv("FLEET_CLUSTER_ENQUEUE_DELAY")); err == nil {
delay = customDelay
}
h.clusters.EnqueueAfter(cluster.Namespace, cluster.Name, clusterEnqueueDelay)
h.clusters.EnqueueAfter(cluster.Namespace, cluster.Name, delay)
}

summary.SetReadyConditions(&status, "Bundle", status.Summary)
Expand Down

0 comments on commit 5955e5e

Please sign in to comment.