]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: cache: align the cache_hint_hits increment with its siblings master
authorMaxime Henrion <mhenrion@haproxy.com>
Fri, 10 Jul 2026 21:55:28 +0000 (17:55 -0400)
committerWilly Tarreau <w@1wt.eu>
Mon, 13 Jul 2026 07:15:06 +0000 (09:15 +0200)
For the sake of consistency, increment cache_hint_hits the same way as the
surrounding cache counters instead of going through a temporary pointer.

No functional change, and nothing to backport.

src/cache.c

index da56966b7747595a122727faf6d8c8eb80cc0df6..319396b0061db407f9b6731373397110fd1bb04e 100644 (file)
@@ -2657,17 +2657,14 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p
 
                if (hint_buf && b_data(hint_buf) > 0 &&
                    cache_emit_early_hints(s, b_orig(hint_buf), b_data(hint_buf))) {
 
                if (hint_buf && b_data(hint_buf) > 0 &&
                    cache_emit_early_hints(s, b_orig(hint_buf), b_data(hint_buf))) {
-                       long long *ctr = NULL;
-
                        if (px == strm_fe(s)) {
                                if (px->fe_counters.shared.tg)
                        if (px == strm_fe(s)) {
                                if (px->fe_counters.shared.tg)
-                                       ctr = &px->fe_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits;
+                                       _HA_ATOMIC_INC(&px->fe_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits);
+                       }
+                       else {
+                               if (px->be_counters.shared.tg)
+                                       _HA_ATOMIC_INC(&px->be_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits);
                        }
                        }
-                       else if (px->be_counters.shared.tg)
-                               ctr = &px->be_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits;
-
-                       if (ctr)
-                               _HA_ATOMIC_INC(ctr);
                }
 
                /* In case of Vary, we could have multiple entries with the same
                }
 
                /* In case of Vary, we could have multiple entries with the same