net/haproxy: fix check interval handling, closes #175

This commit is contained in:
Frank Wall
2017-06-08 16:24:19 +02:00
parent 7a386c6198
commit 42128fb504
3 changed files with 13 additions and 10 deletions
@@ -77,7 +77,7 @@
<id>server.checkInterval</id>
<label>Check Interval</label>
<type>text</type>
<help><![CDATA[Sets the interval (in milliseconds) for running health checks on the server.]]></help>
<help><![CDATA[Sets the interval (in milliseconds) for running health checks on this server. This setting takes precedence. If set, the interval in the healthcheck is ignored.]]></help>
<advanced>true</advanced>
</field>
<field>
@@ -610,10 +610,9 @@
<Required>N</Required>
</weight>
<checkInterval type="TextField">
<default>2s</default>
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
<ValidationMessage>Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us".</ValidationMessage>
<Required>Y</Required>
<Required>N</Required>
</checkInterval>
<checkDownInterval type="TextField">
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
@@ -658,12 +657,11 @@
<ssl>SSL</ssl>
</OptionValues>
</type>
<interval type="IntegerField">
<MinimumValue>250</MinimumValue>
<MaximumValue>1000000</MaximumValue>
<default>1000</default>
<ValidationMessage>Please specify a value between 250 and 1000000.</ValidationMessage>
<Required>N</Required>
<interval type="TextField">
<default>2s</default>
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
<ValidationMessage>Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us".</ValidationMessage>
<Required>Y</Required>
</interval>
<checkport type="IntegerField">
<default></default>
@@ -829,7 +829,12 @@ backend {{backend.name}}
{# # check if health check is enabled #}
{% if healthcheck_enabled == '1' %}
{% do server_options.append('check') %}
{% do server_options.append('inter ' ~ server_data.checkInterval) %}
{# # server settings take precedence over healthcheck settings #}
{% if server_data.checkInterval|default("") != "" %}
{% do server_options.append('inter ' ~ server_data.checkInterval) %}
{% elif healthcheck_data.interval|default("") != "" %}
{% do server_options.append('inter ' ~ healthcheck_data.interval) %}
{% endif %}
{# # use a different interval when server is in DOWN state #}
{% if server_data.checkDownInterval|default("") != "" %}
{% do server_options.append('downinter ' ~ server_data.checkDownInterval) %}