Skip to content

Commit

Permalink
setting ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
enekofb committed Sep 20, 2023
1 parent 4132380 commit 61886ef
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions core/clustersmngr/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"os"
"sync"
"time"

Expand Down Expand Up @@ -34,25 +33,9 @@ const (
)

var (
usersClientsTTL = getEnvDuration("WEAVE_GITOPS_USERS_CLIENTS_TTL", 24*time.Hour)
usersClientsTTL = 24 * time.Hour
)

func getEnvDuration(key string, defaultDuration time.Duration) time.Duration {
val := os.Getenv(key)
if val == "" {
return defaultDuration
}

d, err := time.ParseDuration(val)

// on error return the default duration
if err != nil {
return defaultDuration
}

return d
}

var (
opsUpdateClusters = prometheus.NewCounter(
prometheus.CounterOpts{
Expand Down

0 comments on commit 61886ef

Please sign in to comment.