also catching connection error
This commit is contained in:
parent
855816a576
commit
6a20889d1a
1 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
|
from requests.exceptions import ConnectionError
|
||||||
from influxdb.exceptions import InfluxDBServerError
|
from influxdb.exceptions import InfluxDBServerError
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +25,6 @@ class DBManager(object):
|
||||||
self.logger.debug('Writing Data to InfluxDB %s', d)
|
self.logger.debug('Writing Data to InfluxDB %s', d)
|
||||||
try:
|
try:
|
||||||
self.influx.write_points(d)
|
self.influx.write_points(d)
|
||||||
except InfluxDBServerError as e:
|
except (InfluxDBServerError, ConnectionError) as e:
|
||||||
self.logger.error('Error writing data to influxdb. Dropping this set of data. Check your database! Error: '
|
self.logger.error('Error writing data to influxdb. Dropping this set of data. '
|
||||||
'%s', e)
|
'Check your database! Error: %s', e)
|
||||||
|
|
Loading…
Reference in a new issue