From 6832433eeb3a0282bb2a97113f53327ec0ee2ca5 Mon Sep 17 00:00:00 2001 From: kanoi Date: Tue, 12 May 2015 23:45:04 +1000 Subject: [PATCH] =?UTF-8?q?ckdb=20-=20limit=20reload=20queue=20and=20fix?= =?UTF-8?q?=20reload=20lost=20=E2=88=9E=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ckdb.c | 16 ++++++++++++++++ src/ckdb.h | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ckdb.c b/src/ckdb.c index bd66ef31..e91844de 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -4145,6 +4145,21 @@ static void *socketer(__maybe_unused void *arg) workqueue->code = (char *)__func__; workqueue->inet = inet_default; k_add_tail(workqueue_store, wq_item); + /* Stop the reload queue from growing too big + * Use a size that should be big enough */ + if (reloading && workqueue_store->count > 250000) { + K_ITEM *wq2_item = k_unlink_head(workqueue_store); + K_WUNLOCK(workqueue_free); + WORKQUEUE *wq; + DATA_WORKQUEUE(wq, wq2_item); + K_ITEM *ml_item = wq->msgline_item; + free_msgline_data(ml_item, true, false); + K_WLOCK(msgline_free); + k_add_head(msgline_free, ml_item); + K_WUNLOCK(msgline_free); + K_WLOCK(workqueue_free); + k_add_head(workqueue_free, wq2_item); + } K_WUNLOCK(workqueue_free); ml_item = NULL; mutex_lock(&wq_waitlock); @@ -4744,6 +4759,7 @@ static void *listener(void *arg) seqdata++; } } + ss_item = ss_item->next; } } seqdata_reload_lost = false; diff --git a/src/ckdb.h b/src/ckdb.h index 06327361..31f546f2 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.0" -#define CKDB_VERSION DB_VERSION"-1.104" +#define CKDB_VERSION DB_VERSION"-1.105" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__