From 75422ccf7898e1e998dbe4831c40debbb97f5df2 Mon Sep 17 00:00:00 2001 From: Matthew Robinson Date: Mon, 25 Jan 2016 19:41:06 -0800 Subject: [PATCH 1/2] Add support for managing events.accept_mutex settings --- manifests/config.pp | 2 ++ templates/conf.d/nginx.conf.erb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/manifests/config.pp b/manifests/config.pp index c563736..a40b267 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -43,6 +43,8 @@ class nginx::config( ### END Module/App Configuration ### ### START Nginx Configuration ### + $accept_mutex = 'on', + $accept_mutex_delay = '500ms', $client_body_buffer_size = '128k', $client_max_body_size = '10m', $events_use = false, diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index d0e4bbc..088caa1 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -21,6 +21,10 @@ error_log <%= @nginx_error_log %> <%= @nginx_error_log_severity %>; <% end -%> events { + accept_mutex <%= @accept_mutex %>; + <%- if @accept_mutex_delay -%> + accept_mutex_delay <%= @accept_mutex_delay %>; + <%- end -%> worker_connections <%= @worker_connections -%>; <%- if @multi_accept == 'on' -%> multi_accept on; From 83ab19cdb95bc537f12448cebd665517f7b728ad Mon Sep 17 00:00:00 2001 From: Matthew Robinson Date: Mon, 25 Jan 2016 19:50:19 -0800 Subject: [PATCH 2/2] Add spec tests --- spec/classes/config_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index b1d775f..2207b79 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -124,6 +124,24 @@ describe 'nginx::config' do :value => false, :notmatch => /pid/, }, + { + :title => 'should set accept_mutex on', + :attr => 'accept_mutex', + :value => 'on', + :match => ' accept_mutex on;', + }, + { + :title => 'should set accept_mutex off', + :attr => 'accept_mutex', + :value => 'off', + :match => ' accept_mutex off;', + }, + { + :title => 'should set accept_mutex_delay', + :attr => 'accept_mutex_delay', + :value => '500s', + :match => ' accept_mutex_delay 500s;', + }, { :title => 'should set worker_connections', :attr => 'worker_connections',