Retire piler child after processing max_requests_per_child messages

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2018-03-06 14:42:07 +01:00
parent ae1d551db4
commit 15c9fa7101
3 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@ number_of_worker_processes=2
max_connections=64
; number of processed emails per each piler process
max_requests_per_child=1000
max_requests_per_child=10000
; SMTP HELO identification string
; this should be the FQDN part of the email address

View File

@ -81,7 +81,7 @@ struct _parse_rule config_parse_rules[] =
{ "listen_port", "integer", (void*) int_parser, offsetof(struct config, listen_port), "25", sizeof(int)},
{ "locale", "string", (void*) string_parser, offsetof(struct config, locale), "", MAXVAL-1},
{ "max_connections", "integer", (void*) int_parser, offsetof(struct config, max_connections), "64", sizeof(int)},
{ "max_requests_per_child", "integer", (void*) int_parser, offsetof(struct config, max_requests_per_child), "1000", sizeof(int)},
{ "max_requests_per_child", "integer", (void*) int_parser, offsetof(struct config, max_requests_per_child), "10000", sizeof(int)},
{ "memcached_servers", "string", (void*) string_parser, offsetof(struct config, memcached_servers), "127.0.0.1", MAXVAL-1},
{ "memcached_to_db_interval", "integer", (void*) int_parser, offsetof(struct config, memcached_to_db_interval), "900", sizeof(int)},
{ "memcached_ttl", "integer", (void*) int_parser, offsetof(struct config, memcached_ttl), "86400", sizeof(int)},

View File

@ -283,13 +283,13 @@ void child_main(struct child *ptr){
sig_unblock(SIGHUP);
// TODO: do we want to quit after processing a certain number of messages?
//if(cfg.max_requests_per_child > 0 && ptr->messages >= cfg.max_requests_per_child){
// if(cfg.verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "child (pid: %d, serial: %d) served enough: %d", getpid(), ptr->messages, ptr->serial);
// break;
//}
// Let the child quit after processing max_requests_per_child messages
if(cfg.max_requests_per_child > 0 && ptr->messages >= cfg.max_requests_per_child){
if(cfg.verbosity >= _LOG_DEBUG)
syslog(LOG_PRIORITY, "child (pid: %d, serial: %d) served enough: %d", getpid(), ptr->messages, ptr->serial);
break;
}
}
#ifdef HAVE_MEMCACHED