[smartmeter] Fix flooding logs with warnings if serial port is not accesible (#9781)
Fixes #9780 Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
parent
b6eea715fa
commit
d223696a8e
@ -164,13 +164,13 @@ public abstract class MeterDevice<T> {
|
|||||||
return Flowable.fromPublisher(connector.getMeterValues(initMessage, period, executorService))
|
return Flowable.fromPublisher(connector.getMeterValues(initMessage, period, executorService))
|
||||||
.timeout(timeout + period.toMillis(), TimeUnit.MILLISECONDS, Schedulers.from(executorService))
|
.timeout(timeout + period.toMillis(), TimeUnit.MILLISECONDS, Schedulers.from(executorService))
|
||||||
.doOnSubscribe(sub -> {
|
.doOnSubscribe(sub -> {
|
||||||
logger.info("Opening connection to {}", getDeviceId());
|
logger.debug("Opening connection to {}", getDeviceId());
|
||||||
connector.openConnection();
|
connector.openConnection();
|
||||||
}).doOnError(ex -> {
|
}).doOnError(ex -> {
|
||||||
if (ex instanceof TimeoutException) {
|
if (ex instanceof TimeoutException) {
|
||||||
logger.warn("Timeout occured for {}; {}", getDeviceId(), ex.getMessage());
|
logger.debug("Timeout occured for {}; {}", getDeviceId(), ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to read: {}. Closing connection and trying again in {} seconds...; {}",
|
logger.debug("Failed to read: {}. Closing connection and trying again in {} seconds...; {}",
|
||||||
ex.getMessage(), RETRY_DELAY, getDeviceId(), ex);
|
ex.getMessage(), RETRY_DELAY, getDeviceId(), ex);
|
||||||
}
|
}
|
||||||
connector.closeConnection();
|
connector.closeConnection();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user