dovecot-2.2: lib-master: Added master_service_get_process_min_av...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 4 23:35:37 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/c32bfc54bc50
changeset: 16178:c32bfc54bc50
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 04 23:35:08 2013 +0300
description:
lib-master: Added master_service_get_process_min_avail()

diffstat:

 src/lib-master/master-interface.h       |   4 ++++
 src/lib-master/master-service-private.h |   1 +
 src/lib-master/master-service.c         |  10 ++++++++++
 src/lib-master/master-service.h         |   2 ++
 src/master/service-process.c            |   2 ++
 5 files changed, 19 insertions(+), 0 deletions(-)

diffs (76 lines):

diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-interface.h
--- a/src/lib-master/master-interface.h	Thu Apr 04 23:03:47 2013 +0300
+++ b/src/lib-master/master-interface.h	Thu Apr 04 23:35:08 2013 +0300
@@ -48,6 +48,10 @@
    can be created before reaching the limit */
 #define MASTER_PROCESS_LIMIT_ENV "PROCESS_LIMIT"
 
+/* getenv(MASTER_PROCESS_MIN_AVAIL_ENV) specifies how many processes of this
+   type are created at startup and are kept running all the time */
+#define MASTER_PROCESS_MIN_AVAIL_ENV "PROCESS_MIN_AVAIL"
+
 /* getenv(MASTER_SERVICE_COUNT_ENV) specifies how many client connections the
    process can finish handling before it should kill itself. */
 #define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT"
diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service-private.h
--- a/src/lib-master/master-service-private.h	Thu Apr 04 23:03:47 2013 +0300
+++ b/src/lib-master/master-service-private.h	Thu Apr 04 23:35:08 2013 +0300
@@ -37,6 +37,7 @@
 	unsigned int service_count_left;
 	unsigned int total_available_count;
 	unsigned int process_limit;
+	unsigned int process_min_avail;
 	unsigned int idle_kill_secs;
 
 	struct master_status master_status;
diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service.c
--- a/src/lib-master/master-service.c	Thu Apr 04 23:03:47 2013 +0300
+++ b/src/lib-master/master-service.c	Thu Apr 04 23:35:08 2013 +0300
@@ -216,6 +216,11 @@
 		    count > 0)
 			service->process_limit = count;
 
+		value = getenv(MASTER_PROCESS_MIN_AVAIL_ENV);
+		if (value != NULL && str_to_uint(value, &count) == 0 &&
+		    count > 0)
+			service->process_min_avail = count;
+
 		/* set the default service count */
 		value = getenv(MASTER_SERVICE_COUNT_ENV);
 		if (value != NULL && str_to_uint(value, &count) == 0 &&
@@ -491,6 +496,11 @@
 	return service->process_limit;
 }
 
+unsigned int master_service_get_process_min_avail(struct master_service *service)
+{
+	return service->process_min_avail;
+}
+
 unsigned int master_service_get_idle_kill_secs(struct master_service *service)
 {
 	return service->idle_kill_secs;
diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service.h
--- a/src/lib-master/master-service.h	Thu Apr 04 23:03:47 2013 +0300
+++ b/src/lib-master/master-service.h	Thu Apr 04 23:35:08 2013 +0300
@@ -105,6 +105,8 @@
 /* Returns how many processes of this type can be created before reaching the
    limit. */
 unsigned int master_service_get_process_limit(struct master_service *service);
+/* Returns service { process_min_avail } */
+unsigned int master_service_get_process_min_avail(struct master_service *service);
 /* Returns the service's idle_kill timeout in seconds. Normally master handles
    sending the kill request when the process has no clients, but some services
    with permanent client connections may need to handle this themselves. */
diff -r ef0669c017df -r c32bfc54bc50 src/master/service-process.c
--- a/src/master/service-process.c	Thu Apr 04 23:03:47 2013 +0300
+++ b/src/master/service-process.c	Thu Apr 04 23:35:08 2013 +0300
@@ -228,6 +228,8 @@
 				service->client_limit));
 	env_put(t_strdup_printf(MASTER_PROCESS_LIMIT_ENV"=%u",
 				service->process_limit));
+	env_put(t_strdup_printf(MASTER_PROCESS_MIN_AVAIL_ENV"=%u",
+				service->set->process_min_avail));
 	env_put(t_strdup_printf(MASTER_SERVICE_IDLE_KILL_ENV"=%u",
 				service->idle_kill));
 	if (service->set->service_count != 0) {


More information about the dovecot-cvs mailing list