Commit 7b07fd8e authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Thomas Gambier

promise/plugin: Set good default timeout for check_url_available

promise-timeout provides global timeout for the promise, so use it as
base for calculating default timeout.

/reviewed-on !58
parent 3f508c11
...@@ -20,7 +20,11 @@ class RunPromise(GenericPromise): ...@@ -20,7 +20,11 @@ class RunPromise(GenericPromise):
""" """
url = self.getConfig('url') url = self.getConfig('url')
timeout = int(self.getConfig('timeout', 20)) # make default time a max of 5 seconds, a bit smaller than promise-timeout
# and in the same time at least 1 second
default_timeout = max(
1, min(5, int(self.getConfig('promise-timeout', 20)) - 1))
timeout = int(self.getConfig('timeout', default_timeout))
expected_http_code = int(self.getConfig('http_code', '200')) expected_http_code = int(self.getConfig('http_code', '200'))
ca_cert_file = self.getConfig('ca-cert-file') ca_cert_file = self.getConfig('ca-cert-file')
cert_file = self.getConfig('cert-file') cert_file = self.getConfig('cert-file')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment