This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 51c42dde1b50d4e8c0e9ca4491710fa24a995835
Author: ezelko260 <evan_zelkow...@comcast.com>
AuthorDate: Sat Apr 6 00:31:36 2019 +0000

    Changed how current age is determined to age out documents. Guaranteed 
freshness was being used innapropriately when the docs age was already beyond 
that value
    
    (cherry picked from commit 2c3dd8dd62116c0df3326b69d045a30daa47aad0)
---
 proxy/http/HttpTransact.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index de03df6..e78fdd9 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7172,11 +7172,16 @@ HttpTransact::what_is_document_freshness(State *s, 
HTTPHdr *client_request, HTTP
   current_age = 
HttpTransactHeaders::calculate_document_age(s->request_sent_time, 
s->response_received_time, cached_obj_response,
                                                             response_date, 
s->current.now);
 
-  // Overflow ?
+  // First check overflow status
+  // Second if current_age is under the max, use the smaller value
+  // Finally we take the max of current age or guaranteed max, this ensures it 
will
+  // age out properly, otherwise a doc will never expire if guaranteed < 
document max-age
   if (current_age < 0) {
     current_age = s->txn_conf->cache_guaranteed_max_lifetime;
-  } else {
+  } else if (current_age < s->txn_conf->cache_guaranteed_max_lifetime) {
     current_age = std::min((time_t)s->txn_conf->cache_guaranteed_max_lifetime, 
current_age);
+  } else {
+    current_age = std::max((time_t)s->txn_conf->cache_guaranteed_max_lifetime, 
current_age);
   }
 
   TxnDebug("http_match", "[what_is_document_freshness] fresh_limit:  %d  
current_age: %" PRId64, fresh_limit, (int64_t)current_age);

Reply via email to