]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Optimization: Do not create/configure ACLFilledChecklist in vain (#232)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 2 Jul 2018 12:41:26 +0000 (12:41 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 2 Jul 2018 12:41:31 +0000 (12:41 +0000)
While client_db is required for client-side pools to work, it may be
enabled for other reasons, without any client-side pools configured. We
should not create and configure useless ACLFilledChecklist objects
because those operations are already not trivial today and have a
a tendency of becoming more expensive with time.

src/client_side.cc

index 1e173cd61f8a2a72d174242b97c15a899e8acdef..479c26d81c78373730c773fbb54833de7d5e8e37 100644 (file)
@@ -2464,10 +2464,11 @@ ConnStateData::whenClientIpKnown()
 #if USE_DELAY_POOLS
     fd_table[clientConnection->fd].clientInfo = NULL;
 
-    if (Config.onoff.client_db) {
-        /* it was said several times that client write limiter does not work if client_db is disabled */
+    if (!Config.onoff.client_db)
+        return; // client delay pools require client_db
 
-        auto &pools = ClientDelayPools::Instance()->pools;
+    const auto &pools = ClientDelayPools::Instance()->pools;
+    if (pools.size()) {
         ACLFilledChecklist ch(NULL, NULL, NULL);
 
         // TODO: we check early to limit error response bandwith but we