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

eze pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c3dd8d  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
2c3dd8d is described below

commit 2c3dd8dd62116c0df3326b69d045a30daa47aad0
Author: ezelko260 <[email protected]>
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
---
 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 a85263d..ed30844 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7211,11 +7211,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