mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add a Timeout for InfluxDB connections (#3563)
* Add a Timeout for InfluxDB connections * Removed trailing whitespace
This commit is contained in:
parent
1f1ac02457
commit
183936375f
@ -28,6 +28,7 @@ DEFAULT_PORT = 8086
|
|||||||
DEFAULT_SSL = False
|
DEFAULT_SSL = False
|
||||||
DEFAULT_VERIFY_SSL = False
|
DEFAULT_VERIFY_SSL = False
|
||||||
DOMAIN = 'influxdb'
|
DOMAIN = 'influxdb'
|
||||||
|
TIMEOUT = 5
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.Schema({
|
DOMAIN: vol.Schema({
|
||||||
@ -69,7 +70,8 @@ def setup(hass, config):
|
|||||||
try:
|
try:
|
||||||
influx = InfluxDBClient(
|
influx = InfluxDBClient(
|
||||||
host=host, port=port, username=username, password=password,
|
host=host, port=port, username=username, password=password,
|
||||||
database=database, ssl=ssl, verify_ssl=verify_ssl)
|
database=database, ssl=ssl, verify_ssl=verify_ssl,
|
||||||
|
timeout=TIMEOUT)
|
||||||
influx.query("select * from /.*/ LIMIT 1;")
|
influx.query("select * from /.*/ LIMIT 1;")
|
||||||
except exceptions.InfluxDBClientError as exc:
|
except exceptions.InfluxDBClientError as exc:
|
||||||
_LOGGER.error("Database host is not accessible due to '%s', please "
|
_LOGGER.error("Database host is not accessible due to '%s', please "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user