rawlinp commented on a change in pull request #6527:
URL: https://github.com/apache/trafficcontrol/pull/6527#discussion_r804118620



##########
File path: traffic_monitor/datareq/crstate.go
##########
@@ -51,15 +58,36 @@ func srvTRState(params url.Values, localStates 
peer.CRStatesThreadsafe, combined
                }
        }
 
-       data, err := srvTRStateDerived(combinedStates, peerStates)
+       data, err := srvTRStateDerived(combinedStates, local && 
distributedPollingEnabled)
 
        return data, http.StatusOK, err
 }
 
-func srvTRStateDerived(combinedStates peer.CRStatesThreadsafe, peerStates 
peer.CRStatesPeersThreadsafe) ([]byte, error) {
-       return tc.CRStatesMarshall(combinedStates.Get())
+func srvTRStateDerived(combinedStates peer.CRStatesThreadsafe, 
directlyPolledOnly bool) ([]byte, error) {
+       if !directlyPolledOnly {

Review comment:
       The idea here is that if the `?local` query param is included in the 
request, the client (a distributed peer) is only interested in the caches that 
this TM group polls directly. Otherwise, the client is most likely TR or the 
tc-health-client and is interested in *all* the caches. That is why we do 
filtering for some request types but not others.
   
   However, now that I think of it, the `combinedStates` might already only be 
the caches that are directly polled. I'll have to double-check that.




-- 
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]


Reply via email to