rob05c commented on a change in pull request #4419: ORT Speed Improvements
URL: https://github.com/apache/trafficcontrol/pull/4419#discussion_r382273826
##########
File path: traffic_ops/ort/atstccfg/toreq/caching.go
##########
@@ -105,24 +125,42 @@ func GetJSONObjFromFile(tempDir string, cacheFileName
string, cacheFileMaxAge ti
if err != nil {
return errors.New("getting object file info '" + objPath + "':"
+ err.Error())
}
-
if objFileAge := time.Now().Sub(objFileInfo.ModTime()); objFileAge >
cacheFileMaxAge {
return fmt.Errorf("object file too old, max age %dms less than
file age %dms", int(cacheFileMaxAge/time.Millisecond),
int(objFileAge/time.Millisecond))
}
-
- bts, err := ioutil.ReadAll(objFile)
- if err != nil {
- return errors.New("reading object from file '" + objPath + "':"
+ err.Error())
- }
-
- if err := json.Unmarshal(bts, obj); err != nil {
+ if err := decode(objFile, obj); err != nil {
Review comment:
Changed to return an error, as above
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services