From 5279d23489bfe0b389569353d02ff8c6fc771b1f Mon Sep 17 00:00:00 2001 From: tsthght Date: Mon, 13 Aug 2018 18:30:34 +0800 Subject: [PATCH] fix bug: default-pool-size/max-pool-size can be set dynamically --- src/chassis-options-utils.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/chassis-options-utils.c b/src/chassis-options-utils.c index c9e2990..cbc0a55 100644 --- a/src/chassis-options-utils.c +++ b/src/chassis-options-utils.c @@ -23,6 +23,7 @@ #include "chassis-plugin.h" #include "cetus-util.h" #include "chassis-sql-log.h" +#include "network-backend.h" #include #include @@ -427,6 +428,15 @@ assign_default_pool_size(const gchar *newval, gpointer param) { value = 10; } srv->mid_idle_connections = value; + + network_backends_t *bs = srv->priv->backends; + int back_num = network_backends_count(srv->priv->backends); + int loop = 0; + for (loop = 0; loop < back_num; loop++) { + network_backend_t *backend = network_backends_get(bs, loop); + network_connection_pool *pool = backend->pool; + pool->mid_idle_connections = srv->mid_idle_connections; + } ret = ASSIGN_OK; } else { ret = ASSIGN_VALUE_INVALID; @@ -473,6 +483,15 @@ assign_max_pool_size(const gchar *newval, gpointer param) { } else { srv->max_idle_connections = srv->mid_idle_connections << 1; } + + network_backends_t *bs = srv->priv->backends; + int back_num = network_backends_count(srv->priv->backends); + int loop = 0; + for (loop = 0; loop < back_num; loop++) { + network_backend_t *backend = network_backends_get(bs, loop); + network_connection_pool *pool = backend->pool; + pool->max_idle_connections = srv->max_idle_connections; + } ret = ASSIGN_OK; } else { ret = ASSIGN_VALUE_INVALID;