rob05c commented on a change in pull request #4419: ORT Speed Improvements
URL: https://github.com/apache/trafficcontrol/pull/4419#discussion_r382271542
##########
File path: traffic_ops/ort/atstccfg/toreq/caching.go
##########
@@ -84,17 +105,16 @@ func WriteCacheJSON(tempDir string, cacheFileName string,
obj interface{}) {
}
defer objFile.Close()
- if _, err := objFile.Write(objBts); err != nil {
- log.Errorln("writing object cache file '" + objPath + "': " +
err.Error())
+ if err := encode(objFile, obj); err != nil {
Review comment:
If it's nil it should probably be the default, which is currently Gob.
But, I'd rather it logged/returned an error. I think requiring a valid value
is safer and much easier to debug, than defaulting when the nil pointer could
be an accident.
But yes, the panic is bad.
----------------------------------------------------------------
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