Skip to content

Commit c6cc497

Browse files
committed
setting ttl
1 parent 4132380 commit c6cc497

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

core/clustersmngr/factory.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"os"
87
"sync"
98
"time"
109

@@ -34,25 +33,9 @@ const (
3433
)
3534

3635
var (
37-
usersClientsTTL = getEnvDuration("WEAVE_GITOPS_USERS_CLIENTS_TTL", 24*time.Hour)
36+
usersClientsTTL = 24 * time.Hour
3837
)
3938

40-
func getEnvDuration(key string, defaultDuration time.Duration) time.Duration {
41-
val := os.Getenv(key)
42-
if val == "" {
43-
return defaultDuration
44-
}
45-
46-
d, err := time.ParseDuration(val)
47-
48-
// on error return the default duration
49-
if err != nil {
50-
return defaultDuration
51-
}
52-
53-
return d
54-
}
55-
5639
var (
5740
opsUpdateClusters = prometheus.NewCounter(
5841
prometheus.CounterOpts{

core/clustersmngr/factory_caches.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ func (uc *UsersClients) Set(user *auth.UserPrincipal, clusterName string, client
174174
} else {
175175
uc.log.Info("not found after set")
176176
}
177-
178177
}
179178

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

0 commit comments

Comments
 (0)