File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -641,14 +641,15 @@ func (s *Server) GetDomainLicense(domain string, product string) (*ProductLicens
641
641
return nil , err
642
642
}
643
643
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
+
644
651
var opts ProductLicense
645
652
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
- }
652
653
opts = ProductLicense {
653
654
Domain : domain ,
654
655
Product : product ,
@@ -672,16 +673,9 @@ func (s *Server) GetDomainLicense(domain string, product string) (*ProductLicens
672
673
return nil , err
673
674
}
674
675
675
- var requiredTTL time.Duration
676
- if IsEnterpriseProduct (product ) {
677
- requiredTTL = DefaultTTLForEnterpriseProduct
678
- } else {
679
- requiredTTL = DefaultTTLForCommunityProduct
680
- }
681
-
682
676
// 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
685
679
686
680
data , err = json .Marshal (opts )
687
681
if err != nil {
You can’t perform that action at this time.
0 commit comments