You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/06/29 23:00:44 UTC

[GitHub] [trafficcontrol] rob05c opened a new pull request #5985: Add t3c IMS

rob05c opened a new pull request #5985:
URL: https://github.com/apache/trafficcontrol/pull/5985


   Adds t3c using If-Modified-Since requests to avoid making unnecessary requests to Traffic Ops.
   
   Includes a feature flag `t3c-apply --no-cache` to disable.
   
   Includes tests.
   Includes docs.
   Includes changelog.
   
   - [x] This PR is not related to any other Issue
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Ops ORT
   
   ## What is the best way to verify this PR?
   Run tests. Run t3c twice, verify requests are not made for most endpoints (Traffic Ops doesn't support IMS on Riak "Vault" endpoints, and some are currently broken, but most should work).
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   Not a bug fix.
   
   ## The following criteria are ALL met by this PR
   
   - [x] This PR includes tests OR I have explained why tests are unnecessary
   - [x] This PR includes documentation OR I have explained why documentation is unnecessary
   - [x] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   
   ## Additional Information
   


-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rob05c commented on a change in pull request #5985: Add t3c If-Modified-Since Support

Posted by GitBox <gi...@apache.org>.
rob05c commented on a change in pull request #5985:
URL: https://github.com/apache/trafficcontrol/pull/5985#discussion_r664915269



##########
File path: traffic_ops/toclientlib/toclientlib.go
##########
@@ -808,6 +809,7 @@ type ReqInf struct {
 	CacheHitStatus CacheHitStatus
 	RemoteAddr     net.Addr
 	StatusCode     int
+	Headers        http.Header

Review comment:
       Changed




-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5985: Add t3c If-Modified-Since Support

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5985:
URL: https://github.com/apache/trafficcontrol/pull/5985#discussion_r661114264



##########
File path: traffic_ops/toclientlib/toclientlib.go
##########
@@ -808,6 +809,7 @@ type ReqInf struct {
 	CacheHitStatus CacheHitStatus
 	RemoteAddr     net.Addr
 	StatusCode     int
+	Headers        http.Header

Review comment:
       Should these be called `ResponseHeaders` as opposed to just `Headers`? I think these could be confused as request headers, since the type name is short for "request info".




-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] alficles commented on a change in pull request #5985: Add t3c If-Modified-Since Support

Posted by GitBox <gi...@apache.org>.
alficles commented on a change in pull request #5985:
URL: https://github.com/apache/trafficcontrol/pull/5985#discussion_r666389103



##########
File path: cache-config/t3c-apply/torequest/cmd.go
##########
@@ -361,6 +362,70 @@ func request(cfg config.Cfg, command string) ([]byte, error) {
 	return stdOut, nil
 }
 
+// requestConfig calls t3c-request and returns the stdout bytes.
+// It also caches the config in /var/lib/trafficcontrol-cache-config and uses the cache to issue IMS requests.
+func requestConfig(cfg config.Cfg) ([]byte, error) {
+	// TODO support /opt
+
+	cacheBts := ([]byte)(nil)
+	if !cfg.NoCache {
+		err := error(nil)
+		if cacheBts, err = ioutil.ReadFile(t3cutil.ApplyCachePath); err != nil {
+			// don't log an error if the cache didn't exist
+			if !os.IsNotExist(err) {
+				log.Errorln("getting cached config data failed, not using cache! Error: " + err.Error())
+			}
+			cacheBts = []byte{}

Review comment:
       Tiny nit: There's no reason for a memory allocation here. This could be `nil` instead. But performance here is of no concern.




-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp merged pull request #5985: Add t3c If-Modified-Since Support

Posted by GitBox <gi...@apache.org>.
rawlinp merged pull request #5985:
URL: https://github.com/apache/trafficcontrol/pull/5985


   


-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org