Skip to content

Commit 9b470fc

Browse files
committed
update
Signed-off-by: Tamal Saha <[email protected]>
1 parent a8fc7ed commit 9b470fc

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

pkg/server/server.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,15 @@ func (s *Server) GetDomainLicense(domain string, product string) (*ProductLicens
641641
return nil, err
642642
}
643643

644+
var ttl metav1.Duration
645+
if IsEnterpriseProduct(product) {
646+
ttl = metav1.Duration{Duration: DefaultTTLForEnterpriseProduct}
647+
} else {
648+
ttl = metav1.Duration{Duration: DefaultTTLForCommunityProduct}
649+
}
650+
644651
var opts ProductLicense
645652
if !exists {
646-
var ttl metav1.Duration
647-
if IsEnterpriseProduct(product) {
648-
ttl = metav1.Duration{Duration: DefaultTTLForEnterpriseProduct}
649-
} else {
650-
ttl = metav1.Duration{Duration: DefaultTTLForCommunityProduct}
651-
}
652653
opts = ProductLicense{
653654
Domain: domain,
654655
Product: product,
@@ -672,16 +673,9 @@ func (s *Server) GetDomainLicense(domain string, product string) (*ProductLicens
672673
return nil, err
673674
}
674675

675-
var requiredTTL time.Duration
676-
if IsEnterpriseProduct(product) {
677-
requiredTTL = DefaultTTLForEnterpriseProduct
678-
} else {
679-
requiredTTL = DefaultTTLForCommunityProduct
680-
}
681-
682676
// If the stored TTL is too low, bump it and persist
683-
if opts.TTL.Duration < requiredTTL {
684-
opts.TTL.Duration = requiredTTL
677+
if opts.TTL != nil && opts.TTL.Duration < ttl.Duration {
678+
opts.TTL.Duration = ttl.Duration
685679

686680
data, err = json.Marshal(opts)
687681
if err != nil {

0 commit comments

Comments
 (0)