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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]