summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2023-11-14 18:39:44 +0200
committerGitHub <noreply@github.com>2023-11-14 16:39:44 +0000
commitf9db941faf3e5bb80144640b7f6059ed42a5ff4d (patch)
treeb085cf25849aa6112c80a84ca55f53366a0dff08
parenta6e8205835b7b58e4ae84b7de278e9c432c08f6e (diff)
fix: don't count reused connections as new (#16414)
-rw-r--r--web/server/web_client_cache.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/web/server/web_client_cache.c b/web/server/web_client_cache.c
index 5aa3af22e9..5a68808c62 100644
--- a/web/server/web_client_cache.c
+++ b/web/server/web_client_cache.c
@@ -91,20 +91,19 @@ struct web_client *web_client_get_from_cache(void) {
// get it from avail
DOUBLE_LINKED_LIST_REMOVE_ITEM_UNSAFE(web_clients_cache.avail.head, w, cache.prev, cache.next);
web_clients_cache.avail.count--;
- spinlock_unlock(&web_clients_cache.avail.spinlock);
+ spinlock_unlock(&web_clients_cache.avail.spinlock);
web_client_reuse_from_cache(w);
-
spinlock_lock(&web_clients_cache.used.spinlock);
+
web_clients_cache.used.reused++;
}
else {
spinlock_unlock(&web_clients_cache.avail.spinlock);
-
- // allocate it
w = web_client_create(&netdata_buffers_statistics.buffers_web);
-
spinlock_lock(&web_clients_cache.used.spinlock);
+
+ w->id = global_statistics_web_client_connected();
web_clients_cache.used.allocated++;
}
@@ -115,7 +114,6 @@ struct web_client *web_client_get_from_cache(void) {
// initialize it
w->use_count++;
- w->id = global_statistics_web_client_connected();
w->mode = WEB_CLIENT_MODE_GET;
return w;