ezelkow1 commented on code in PR #12852:
URL: https://github.com/apache/trafficserver/pull/12852#discussion_r2770300465


##########
src/proxy/http/HttpTransact.cc:
##########
@@ -2942,14 +2954,26 @@ HttpTransact::HandleCacheOpenReadHit(State *s)
 
   HttpCacheSM &cache_sm = s->state_machine->get_cache_sm();
   TxnDbg(dbg_ctl_http_trans, "CacheOpenRead --- HIT-FRESH read while write 
%d", cache_sm.is_readwhilewrite_inprogress());
-  if (cache_sm.is_readwhilewrite_inprogress())
+  if (cache_sm.is_readwhilewrite_inprogress()) {
     SET_VIA_STRING(VIA_CACHE_RESULT, VIA_IN_CACHE_RWW_HIT);
+  }
+
+  // If serving stale due to write lock failure (actions 2, 3, or 6), adjust 
VIA to reflect stale serving.
+  // This ensures correct statistics attribution (cache_hit_stale_served 
instead of cache_hit_fresh).
+  if (s->serving_stale_due_to_write_lock) {
+    TxnDbg(dbg_ctl_http_trans, "Serving stale due to write lock failure, 
adjusting VIA for statistics");
+    SET_VIA_STRING(VIA_CACHE_RESULT, VIA_IN_CACHE_STALE);

Review Comment:
   adding



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