diff --git a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/InfluxDBPersistenceService.java b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/InfluxDBPersistenceService.java index 358bd778a..ee2ba5190 100644 --- a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/InfluxDBPersistenceService.java +++ b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/InfluxDBPersistenceService.java @@ -286,6 +286,7 @@ public class InfluxDBPersistenceService implements ModifiablePersistenceService if (!influxDBRepository.write(points)) { logger.warn("Re-queuing {} elements, failed to write batch.", points.size()); pointsQueue.addAll(points); + influxDBRepository.disconnect(); } else { logger.trace("Wrote {} elements to database", points.size()); } diff --git a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java index 862ecf4c2..77ef19800 100644 --- a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java +++ b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java @@ -44,6 +44,7 @@ import com.influxdb.client.InfluxDBClientFactory; import com.influxdb.client.InfluxDBClientOptions; import com.influxdb.client.QueryApi; import com.influxdb.client.WriteApi; +import com.influxdb.client.domain.HealthCheck; import com.influxdb.client.domain.Ready; import com.influxdb.client.domain.WritePrecision; import com.influxdb.client.write.Point; @@ -76,7 +77,8 @@ public class InfluxDB2RepositoryImpl implements InfluxDBRepository { @Override public boolean isConnected() { - return client != null; + InfluxDBClient client = this.client; + return client != null && client.health().getStatus() == HealthCheck.StatusEnum.PASS; } @Override