Skip to content

Commit

Permalink
Retire piler child after processing max_requests_per_child messages
Browse files Browse the repository at this point in the history
Signed-off-by: Janos SUTO <sj@acts.hu>
  • Loading branch information
jsuto committed Mar 6, 2018
1 parent ae1d551 commit 15c9fa7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion etc/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
12 changes: 6 additions & 6 deletions src/piler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15c9fa7

Please sign in to comment.