rawlinp commented on code in PR #6754:
URL: https://github.com/apache/trafficcontrol/pull/6754#discussion_r861198495


##########
traffic_ops/traffic_ops_golang/routing/routing.go:
##########
@@ -46,6 +51,28 @@ import (
 // RoutePrefix is a prefix that all API routes must match.
 const RoutePrefix = "^api" // TODO config?
 
+type backendConfigSynced struct {
+       cfg config.BackendConfig
+       *sync.RWMutex
+}
+
+// backendCfg stores the current backend config supplied to traffic ops.
+var backendCfg = backendConfigSynced{RWMutex: &sync.RWMutex{}}
+
+// GetBackendConfig returns the current BackendConfig.
+func GetBackendConfig() config.BackendConfig {
+       backendCfg.RLock()
+       defer backendCfg.RUnlock()
+       return backendCfg.cfg
+}
+
+// SetBackendConfig sets the BackendConfig to the value supplied.
+func SetBackendConfig(backendConfig config.BackendConfig) {
+       backendCfg.RLock()
+       defer backendCfg.RUnlock()

Review Comment:
   I believe these are meant to be `Lock()` and `Unlock()`, because we are 
writing to the shared value here rather than reading.



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