alficles commented on a change in pull request #4419: ORT Speed Improvements
URL: https://github.com/apache/trafficcontrol/pull/4419#discussion_r382303455
 
 

 ##########
 File path: traffic_ops/ort/traffic_ops_ort.pl
 ##########
 @@ -1508,12 +1512,22 @@ sub lwp_get {
 
        my ( $TO_USER, $TO_PASS ) = split( /:/, $TM_LOGIN );
 
+       # atstccfg_cache_cleared is a global variable we use to clear the 
atstccfg cache on the first atstccfg call.
+       # Telling atstccfg to use-cache=false will cause it to delete the cache 
directory
+       # Which is what we want: when ORT starts to run, delete the cache. We 
only want to use the atstccfg cache within the same ORT run, not across 
different runs.
+
        my $no_cache_arg = '';
-       if ( $use_cache == 0 ) {
+       if ( $use_cache == 0 || $atstccfg_cache_cleared == 0 ) {
+               $atstccfg_cache_cleared = 1;
                $no_cache_arg = '--no-cache';
        }
 
-       $response_content = `$atstccfg_cmd $no_cache_arg 
--traffic-ops-user='$TO_USER' --traffic-ops-password='$TO_PASS' 
--traffic-ops-url='$request' --log-location-error=stderr 
--log-location-warning=stderr --log-location-info=null 2>$atstccfg_log_path`;
+       my $cache_age_arg='';
+       if (length $cache_max_age_seconds > 0) {
+               $cache_age_arg = 
"--cache-file-max-age-seconds=$cache_max_age_seconds";
+       }
+
+       $response_content = `$atstccfg_cmd $no_cache_arg $cache_age_arg 
--traffic-ops-user='$TO_USER' --traffic-ops-password='$TO_PASS' 
--traffic-ops-url='$request' --log-location-error=stderr 
--log-location-warning=stderr --log-location-info=null 2>$atstccfg_log_path`;
 
 Review comment:
   This introduces an unnecessary space when you don't pass `--no-cache`.

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

Reply via email to