# HG changeset patch # User jbe # Date 1427218719 -3600 # Node ID 93b32111526f2a077ab07467248f7b6bc47baf0f # Parent ee63ad6bb3e3f6b739073bfbf7ea69122ef89f54 Work on network configuration diff -r ee63ad6bb3e3 -r 93b32111526f app/main/_prefork/10_init.lua --- a/app/main/_prefork/10_init.lua Tue Mar 24 12:55:22 2015 +0100 +++ b/app/main/_prefork/10_init.lua Tue Mar 24 18:38:39 2015 +0100 @@ -1,20 +1,36 @@ -if not config.fork then +if config.fork == nil then config.fork = {} end -if not config.fork.pre then - config.fork.pre = 4 +if config.fork.pre == nil then + config.fork.pre = 2 end -if not config.fork.max then +if config.fork.min == nil then + config.fork.min = 4 +end + +if config.fork.max == nil then config.fork.max = 8 end -if not config.fork.delay then - config.fork.delay = 1 +if config.fork.delay == nil then + config.fork.delay = 0.125 +end + +if config.fork.error_delay == nil then + config.fork.error_delay = 2 end -if not config.port then +if config.fork.exit_delay == nil then + config.fork.exit_delay = 2 +end + +if config.fork.idle_timeout == nil then + config.fork.idle_timeout = 900 +end + +if config.port == nil then config.port = 8080 end @@ -22,14 +38,39 @@ config.localhost = true end +local listen_options = { + pre_fork = config.fork.pre, + min_fork = config.fork.min, + max_fork = config.fork.max, + fork_delay = config.fork.delay, + fork_error_delay = config.fork.error_delay, + exit_delay = config.fork.exit_delay, + idle_timeout = config.fork.idle_timeout, + min_requests_per_fork = config.fork.min_requests, + max_requests_per_fork = config.fork.max_requests, + http_options = config.http_options +} + +if config.ipv6 then + listen_options[#listen_options+1] = { proto = "tcp6", port = config.port, localhost = config.localhost } +end +if config.ipv6 ~= "only" then + listen_options[#listen_options+1] = { proto = "tcp4", port = config.port, localhost = config.localhost } +end + +listen(listen_options) + listen{ - { proto = "tcp4", port = config.port, localhost = true }, - { proto = "interval", delay = 5, handler = function() - Event:send_pending_notifications() - end }, - pre_fork = config.fork.pre, - max_fork = config.fork.max, - fork_delay = config.fork.delay + { + proto = "interval", + name = "send_pending_notifications", + delay = 5, + handler = function() + Event:send_pending_notifications() + end + }, + min_fork = 1, + max_fork = 1 } execute.inner() diff -r ee63ad6bb3e3 -r 93b32111526f config/init.lua --- a/config/init.lua Tue Mar 24 12:55:22 2015 +0100 +++ b/config/init.lua Tue Mar 24 18:38:39 2015 +0100 @@ -115,4 +115,4 @@ request.add_header("Cache-Control", "max-age=3600"); end -end \ No newline at end of file +end