zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997517886


##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go:
##########
@@ -43,14 +43,33 @@ const DefaultTLDTTLNS = 3600 * time.Second
 const GeoProviderMaxmindStr = "maxmindGeolocationService"
 const GeoProviderNeustarStr = "neustarGeolocationService"
 
-func makeDSes(cdn string, domain string, tx *sql.Tx) 
(map[string]tc.CRConfigDeliveryService, error) {
+func makeDSes(cdn string, domain string, ttlOverride int, tx *sql.Tx) 
(map[string]tc.CRConfigDeliveryService, error) {
        dses := map[string]tc.CRConfigDeliveryService{}
 
        admin := CDNSOAAdmin
-       expireSecondsStr := strconv.Itoa(int(CDNSOAExpire / time.Second))
-       minimumSecondsStr := strconv.Itoa(int(CDNSOAMinimum / time.Second))
-       refreshSecondsStr := strconv.Itoa(int(CDNSOARefresh / time.Second))
-       retrySecondsStr := strconv.Itoa(int(CDNSOARetry / time.Second))
+       expireSeconds := int(CDNSOAExpire / time.Second)
+       minimumSeconds := int(CDNSOAMinimum / time.Second)
+       refreshSeconds := int(CDNSOARefresh / time.Second)
+       retrySeconds := int(CDNSOARetry / time.Second)
+       if ttlOverride > 0 {
+               if ttlOverride < expireSeconds {

Review Comment:
   Using `math.Min()` in f1340e3d56



##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go:
##########
@@ -35,19 +35,53 @@ import (
        "gopkg.in/DATA-DOG/go-sqlmock.v1"
 )
 
-func randDS() tc.CRConfigDeliveryService {
+func randDS(ttlOverride int) tc.CRConfigDeliveryService {
        // truePtr := true
        falseStrPtr := "false"
        // numStr := "42"
        ttlAdmin := "traffic_ops"
-       ttlExpire := "604800"
-       ttlMinimum := "30"
-       ttlRefresh := "28800"
-       ttlRetry := "7200"
-       ttl := util.IntPtr(test.RandInt())
-       ttlStr := strconv.Itoa(*ttl)
-       ttlNS := "3600"
-       ttlSOA := "86400"
+       ttlExpire := 604800
+       ttlMinimum := 30
+       ttlRefresh := 28800
+       ttlRetry := 7200
+       if ttlOverride > 0 {
+               if ttlOverride < ttlExpire {

Review Comment:
   Using `math.Min()` in f1340e3d56



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to