From: Timo Sirainen Date: Sun, 14 Aug 2011 18:02:43 +0000 (+0300) Subject: indexer: Don't die on "idle kill signal" if workers are still busy. X-Git-Tag: 2.1.alpha1~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df26373d0aa3cb208da213fce32e2abc5d97f90b;p=thirdparty%2Fdovecot%2Fcore.git indexer: Don't die on "idle kill signal" if workers are still busy. --- diff --git a/src/indexer/indexer.c b/src/indexer/indexer.c index 3401c38b97..166e75c49f 100644 --- a/src/indexer/indexer.c +++ b/src/indexer/indexer.c @@ -31,7 +31,8 @@ void indexer_refresh_proctitle(void) static bool idle_die(void) { - return indexer_queue_is_empty(queue); + return indexer_queue_is_empty(queue) && + !worker_pool_have_busy_connections(worker_pool); } static void client_connected(struct master_service_connection *conn) diff --git a/src/indexer/worker-pool.c b/src/indexer/worker-pool.c index aa20e749e5..2d31e65586 100644 --- a/src/indexer/worker-pool.c +++ b/src/indexer/worker-pool.c @@ -61,6 +61,11 @@ void worker_pool_deinit(struct worker_pool **_pool) i_free(pool); } +bool worker_pool_have_busy_connections(struct worker_pool *pool) +{ + return pool->busy_list != NULL; +} + static int worker_pool_add_connection(struct worker_pool *pool) { struct worker_connection *conn; diff --git a/src/indexer/worker-pool.h b/src/indexer/worker-pool.h index fcd4c2193b..80ec4b0bc0 100644 --- a/src/indexer/worker-pool.h +++ b/src/indexer/worker-pool.h @@ -9,6 +9,8 @@ struct worker_pool * worker_pool_init(const char *socket_path, indexer_status_callback_t *callback); void worker_pool_deinit(struct worker_pool **pool); +bool worker_pool_have_busy_connections(struct worker_pool *pool); + bool worker_pool_get_connection(struct worker_pool *pool, struct worker_connection **conn_r); void worker_pool_release_connection(struct worker_pool *pool,