changeset 13235:221d159befec

indexer: Don't die on "idle kill signal" if workers are still busy.
author Timo Sirainen <tss@iki.fi>
date Sun, 14 Aug 2011 21:02:43 +0300
parents 0ef83aa215d3
children 1a2ad02123f1
files src/indexer/indexer.c src/indexer/worker-pool.c src/indexer/worker-pool.h
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/indexer/indexer.c	Sun Aug 14 20:55:32 2011 +0300
+++ b/src/indexer/indexer.c	Sun Aug 14 21:02:43 2011 +0300
@@ -31,7 +31,8 @@
 
 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)
--- a/src/indexer/worker-pool.c	Sun Aug 14 20:55:32 2011 +0300
+++ b/src/indexer/worker-pool.c	Sun Aug 14 21:02:43 2011 +0300
@@ -61,6 +61,11 @@
 	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;
--- a/src/indexer/worker-pool.h	Sun Aug 14 20:55:32 2011 +0300
+++ b/src/indexer/worker-pool.h	Sun Aug 14 21:02:43 2011 +0300
@@ -9,6 +9,8 @@
 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,