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 2020/01/24 21:38:39 UTC

[GitHub] [trafficcontrol] rob05c commented on a change in pull request #4289: Fix atstccfg caching

rob05c commented on a change in pull request #4289: Fix atstccfg caching
URL: https://github.com/apache/trafficcontrol/pull/4289#discussion_r370854035
 
 

 ##########
 File path: traffic_ops/ort/atstccfg/toreq/caching.go
 ##########
 @@ -84,7 +84,12 @@ func WriteCacheJSON(tempDir string, cacheFileName string, obj interface{}) {
 	}
 	defer objFile.Close()
 
-	if _, err := objFile.Write(objBts); err != nil {
+	if err := objFile.Truncate(0); err != nil { // must truncate, or Write will leave whatever existed after the beginning, if the file already existed and was longer than our new write.
 
 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services