liquid_feedback_frontend
diff app/main/_prefork/10_init.lua @ 1167:93b32111526f
Work on network configuration
author | jbe |
---|---|
date | Tue Mar 24 18:38:39 2015 +0100 (2015-03-24) |
parents | e9f6ae14bc72 |
children | 3b00c08a6b90 |
line diff
1.1 --- a/app/main/_prefork/10_init.lua Tue Mar 24 12:55:22 2015 +0100 1.2 +++ b/app/main/_prefork/10_init.lua Tue Mar 24 18:38:39 2015 +0100 1.3 @@ -1,20 +1,36 @@ 1.4 -if not config.fork then 1.5 +if config.fork == nil then 1.6 config.fork = {} 1.7 end 1.8 1.9 -if not config.fork.pre then 1.10 - config.fork.pre = 4 1.11 +if config.fork.pre == nil then 1.12 + config.fork.pre = 2 1.13 end 1.14 1.15 -if not config.fork.max then 1.16 +if config.fork.min == nil then 1.17 + config.fork.min = 4 1.18 +end 1.19 + 1.20 +if config.fork.max == nil then 1.21 config.fork.max = 8 1.22 end 1.23 1.24 -if not config.fork.delay then 1.25 - config.fork.delay = 1 1.26 +if config.fork.delay == nil then 1.27 + config.fork.delay = 0.125 1.28 +end 1.29 + 1.30 +if config.fork.error_delay == nil then 1.31 + config.fork.error_delay = 2 1.32 end 1.33 1.34 -if not config.port then 1.35 +if config.fork.exit_delay == nil then 1.36 + config.fork.exit_delay = 2 1.37 +end 1.38 + 1.39 +if config.fork.idle_timeout == nil then 1.40 + config.fork.idle_timeout = 900 1.41 +end 1.42 + 1.43 +if config.port == nil then 1.44 config.port = 8080 1.45 end 1.46 1.47 @@ -22,14 +38,39 @@ 1.48 config.localhost = true 1.49 end 1.50 1.51 +local listen_options = { 1.52 + pre_fork = config.fork.pre, 1.53 + min_fork = config.fork.min, 1.54 + max_fork = config.fork.max, 1.55 + fork_delay = config.fork.delay, 1.56 + fork_error_delay = config.fork.error_delay, 1.57 + exit_delay = config.fork.exit_delay, 1.58 + idle_timeout = config.fork.idle_timeout, 1.59 + min_requests_per_fork = config.fork.min_requests, 1.60 + max_requests_per_fork = config.fork.max_requests, 1.61 + http_options = config.http_options 1.62 +} 1.63 + 1.64 +if config.ipv6 then 1.65 + listen_options[#listen_options+1] = { proto = "tcp6", port = config.port, localhost = config.localhost } 1.66 +end 1.67 +if config.ipv6 ~= "only" then 1.68 + listen_options[#listen_options+1] = { proto = "tcp4", port = config.port, localhost = config.localhost } 1.69 +end 1.70 + 1.71 +listen(listen_options) 1.72 + 1.73 listen{ 1.74 - { proto = "tcp4", port = config.port, localhost = true }, 1.75 - { proto = "interval", delay = 5, handler = function() 1.76 - Event:send_pending_notifications() 1.77 - end }, 1.78 - pre_fork = config.fork.pre, 1.79 - max_fork = config.fork.max, 1.80 - fork_delay = config.fork.delay 1.81 + { 1.82 + proto = "interval", 1.83 + name = "send_pending_notifications", 1.84 + delay = 5, 1.85 + handler = function() 1.86 + Event:send_pending_notifications() 1.87 + end 1.88 + }, 1.89 + min_fork = 1, 1.90 + max_fork = 1 1.91 } 1.92 1.93 execute.inner()