mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Fix exception handling for InfluxDB 1.x (#16234)
Fixes #16233 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
923a568af9
commit
e759c85353
@ -75,12 +75,17 @@ public class InfluxDB1RepositoryImpl implements InfluxDBRepository {
|
||||
|
||||
@Override
|
||||
public boolean connect() {
|
||||
final InfluxDB createdClient = InfluxDBFactory.connect(configuration.getUrl(), configuration.getUser(),
|
||||
configuration.getPassword());
|
||||
createdClient.setDatabase(configuration.getDatabaseName());
|
||||
createdClient.setRetentionPolicy(configuration.getRetentionPolicy());
|
||||
createdClient.enableBatch(200, 100, TimeUnit.MILLISECONDS);
|
||||
this.client = createdClient;
|
||||
try {
|
||||
final InfluxDB createdClient = InfluxDBFactory.connect(configuration.getUrl(), configuration.getUser(),
|
||||
configuration.getPassword());
|
||||
createdClient.setDatabase(configuration.getDatabaseName());
|
||||
createdClient.setRetentionPolicy(configuration.getRetentionPolicy());
|
||||
createdClient.enableBatch(200, 100, TimeUnit.MILLISECONDS);
|
||||
this.client = createdClient;
|
||||
} catch (InfluxException | InfluxDBException e) {
|
||||
logger.debug("Connection failed", e);
|
||||
return false;
|
||||
}
|
||||
return checkConnectionStatus();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user