shamrickus commented on a change in pull request #4916:
URL: https://github.com/apache/trafficcontrol/pull/4916#discussion_r466692742



##########
File path: traffic_monitor/manager/opsconfig.go
##########
@@ -169,42 +164,26 @@ func StartOpsConfigManager(
                        backoff = 
util.NewConstantBackoff(util.ConstantBackoffDuration)
                }
                for {
-                       realToSession, toAddr, err = 
to.LoginWithAgent(newOpsConfig.Url, newOpsConfig.Username, 
newOpsConfig.Password, newOpsConfig.Insecure, staticAppData.UserAgent, 
useCache, trafficOpsRequestTimeout)
+                       err = toSession.Update(newOpsConfig.Url, 
newOpsConfig.Username, newOpsConfig.Password, newOpsConfig.Insecure, 
staticAppData.UserAgent, useCache, trafficOpsRequestTimeout)
                        if err != nil {
                                handleErr(fmt.Errorf("MonitorConfigPoller: 
error instantiating Session with traffic_ops (%v): %s\n", toAddr, err))
                                duration := backoff.BackoffDuration()
                                log.Errorf("retrying in %v\n", duration)
                                time.Sleep(duration)
 
                                if toSession.BackupFileExists() && 
(toLoginCount >= cfg.TrafficOpsDiskRetryMax) {
-                                       jar, err := cookiejar.New(nil)
-                                       if err != nil {
-                                               log.Errorf("Err getting 
cookiejar")
-                                               continue
-                                       }
-
-                                       realToSession = 
to.NewSession(newOpsConfig.Username, newOpsConfig.Password, newOpsConfig.Url, 
staticAppData.UserAgent, &http.Client{
-                                               Timeout: 
trafficOpsRequestTimeout,
-                                               Transport: &http.Transport{
-                                                       TLSClientConfig: 
&tls.Config{InsecureSkipVerify: true},
-                                               },
-                                               Jar: jar,
-                                       }, useCache)
-                                       toSession.Set(realToSession)
-                                       // At this point we have a valid 
'dummy' session. This will allow us to pull from disk but will also retry when 
TO comes up

Review comment:
       Depends on what you mean by working. In a strict sense, no it is not. 
After further review you should be good on this, it looks like it was 
originally just a copy paste of the Login function anyways.
   
   This shouldn't be an issue, but I think it's worth noting: With these 
changes (assuming TO is down), each attempt will take twice as long since it 
tries both legacy and new TO.




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


Reply via email to