Also rename related functions and macros.
This clarifies a bit what the setting does: It's the interval between
killing idle processes, not the amount of time when an idling process
is killed.
.process_min_avail = 1,
.process_limit = 1,
- .idle_kill = SET_TIME_INFINITE,
+ .idle_kill_interval = SET_TIME_INFINITE,
.unix_listeners = ARRAY_INIT,
.fifo_listeners = ARRAY_INIT,
server->refcount = 1;
server->auth = auth;
server->conn.event_parent = auth_event;
- server->conn.input_idle_timeout_secs = master_service_get_idle_kill_secs(master_service);
+ server->conn.input_idle_timeout_secs =
+ master_service_get_idle_kill_interval_secs(master_service);
connection_init_server(clients, &server->conn, master_conn->name,
master_conn->fd, master_conn->fd);
auth_worker_server_send_handshake(&server->conn);
.drop_priv_before_exec = FALSE,
- .idle_kill = SET_TIME_INFINITE,
+ .idle_kill_interval = SET_TIME_INFINITE,
.unix_listeners = ARRAY_INIT,
.fifo_listeners = ARRAY_INIT,
process can finish handling before it should kill itself. */
#define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT"
-/* getenv(MASTER_SERVICE_IDLE_KILL_ENV) specifies service's idle_kill timeout
- in seconds. */
-#define MASTER_SERVICE_IDLE_KILL_ENV "IDLE_KILL"
+/* getenv(MASTER_SERVICE_IDLE_KILL_ENV) specifies service's idle_kill_interval
+ timeout in seconds. */
+#define MASTER_SERVICE_IDLE_KILL_INTERVAL_ENV "IDLE_KILL_INTERVAL"
/* getenv(MASTER_CONFIG_FILE_ENV) provides path to configuration file. */
#define MASTER_CONFIG_FILE_ENV "CONFIG_FILE"
unsigned int total_available_count;
unsigned int process_limit;
unsigned int process_min_avail;
- unsigned int idle_kill_secs;
+ unsigned int idle_kill_interval_secs;
struct master_status master_status;
unsigned int last_sent_status_avail_count;
master_service_set_restart_request_count(service, count);
/* set the idle kill timeout */
- value = getenv(MASTER_SERVICE_IDLE_KILL_ENV);
+ value = getenv(MASTER_SERVICE_IDLE_KILL_INTERVAL_ENV);
if (value != NULL && str_to_uint(value, &count) == 0)
- service->idle_kill_secs = count;
+ service->idle_kill_interval_secs = count;
} else {
master_service_set_client_limit(service, 1);
master_service_set_restart_request_count(service, 1);
return service->process_min_avail;
}
-unsigned int master_service_get_idle_kill_secs(struct master_service *service)
+unsigned int
+master_service_get_idle_kill_interval_secs(struct master_service *service)
{
- return service->idle_kill_secs;
+ return service->idle_kill_interval_secs;
}
void master_service_set_restart_request_count(struct master_service *service,
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. */
-unsigned int master_service_get_idle_kill_secs(struct master_service *service);
+/* Returns the service's idle_kill_interval 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. */
+unsigned int
+master_service_get_idle_kill_interval_secs(struct master_service *service);
/* Set maximum number of client connections we will handle before shutting
down. */
unsigned int process_limit;
unsigned int client_limit;
unsigned int restart_request_count;
- unsigned int idle_kill;
+ unsigned int idle_kill_interval;
uoff_t vsz_limit;
ARRAY_TYPE(const_string) unix_listeners;
.drop_priv_before_exec = FALSE,
.process_limit = 1,
- .idle_kill = SET_TIME_INFINITE,
+ .idle_kill_interval = SET_TIME_INFINITE,
.unix_listeners = ARRAY_INIT,
.fifo_listeners = ARRAY_INIT,
DEF(UINT, process_limit),
DEF(UINT, client_limit),
DEF(UINT, restart_request_count),
- DEF(TIME, idle_kill),
+ DEF(TIME, idle_kill_interval),
DEF(SIZE, vsz_limit),
{ .type = SET_FILTER_ARRAY, .key = "unix_listener",
.process_limit = 100,
.client_limit = 1000,
.restart_request_count = SET_UINT_UNLIMITED,
- .idle_kill = 60,
+ .idle_kill_interval = 60,
.vsz_limit = 256*1024*1024,
.unix_listeners = ARRAY_INIT,
service->name);
return FALSE;
}
- if (service->idle_kill == 0) {
+ if (service->idle_kill_interval == 0) {
*error_r = t_strdup_printf("service(%s): "
- "idle_kill must be higher than 0",
+ "idle_kill_interval must be higher than 0",
service->name);
return FALSE;
}
}
process->last_kill_sent = ioloop_time;
process->to_idle_kill =
- timeout_add(service->idle_kill * 1000,
+ timeout_add(service->idle_kill_interval * 1000,
service_process_idle_kill_timeout, process);
/* Move it to the end of the list, so it's not tried to be
if (service->process_avail > service->set->process_min_avail &&
service->to_idle == NULL &&
- service->idle_kill != UINT_MAX) {
+ service->idle_kill_interval != UINT_MAX) {
/* We have more processes than we really need. Start a timer
- to trigger idle_kill. */
+ to trigger idle_kill_interval. */
service->to_idle =
- timeout_add(service->idle_kill * 1000,
+ timeout_add(service->idle_kill_interval * 1000,
service_kill_idle, service);
}
}
env_put(MASTER_PROCESS_LIMIT_ENV, dec2str(service->process_limit));
env_put(MASTER_PROCESS_MIN_AVAIL_ENV,
dec2str(service->set->process_min_avail));
- env_put(MASTER_SERVICE_IDLE_KILL_ENV, dec2str(service->idle_kill));
+ env_put(MASTER_SERVICE_IDLE_KILL_INTERVAL_ENV,
+ dec2str(service->idle_kill_interval));
if (service->set->restart_request_count != 0) {
env_put(MASTER_SERVICE_COUNT_ENV,
dec2str(service->set->restart_request_count));
service->client_limit = set->restart_request_count;
service->vsz_limit = set->vsz_limit;
- service->idle_kill = set->idle_kill;
+ service->idle_kill_interval = set->idle_kill_interval;
service->type = service->set->parsed_type;
service->process_limit = set->process_limit;
/* number of processes currently idling (idle_start != 0) */
unsigned int process_idling;
/* Lowest number of processes that have been idling at the same time.
- This is reset to process_idling every idle_kill seconds. */
+ This is reset to process_idling every idle_kill_interval seconds. */
unsigned int process_idling_lowwater_since_kills;
/* max number of processes allowed */
unsigned int process_limit;
/* Maximum number of client connections a process can handle. */
unsigned int client_limit;
/* Kill idling processes after this many seconds. */
- unsigned int idle_kill;
+ unsigned int idle_kill_interval;
/* set->vsz_limit or set->master_set->default_client_limit */
uoff_t vsz_limit;
.drop_priv_before_exec = FALSE,
.process_limit = 1,
- .idle_kill = SET_TIME_INFINITE,
+ .idle_kill_interval = SET_TIME_INFINITE,
.unix_listeners = ARRAY_INIT,
.inet_listeners = ARRAY_INIT,