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 c6cc497
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 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
1 change: 0 additions & 1 deletion core/clustersmngr/factory_caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ func (uc *UsersClients) Set(user *auth.UserPrincipal, clusterName string, client
} else {
uc.log.Info("not found after set")
}

}

func (uc *UsersClients) Get(user *auth.UserPrincipal, clusterName string) (client.Client, bool) {
Expand Down

0 comments on commit c6cc497

Please sign in to comment.