[buienradar] Avoid to much log noise (#9804)

Signed-off-by: Björn Brings <bjoernbrings@web.de>
This commit is contained in:
Björn Brings 2021-01-18 08:35:11 +01:00 committed by GitHub
parent 3c27aeb621
commit c341c509b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 10 deletions

View File

@ -76,7 +76,6 @@ public class BuienradarHandler extends BaseThingHandler {
public void handleCommand(ChannelUID channelUID, Command command) { public void handleCommand(ChannelUID channelUID, Command command) {
} }
@SuppressWarnings("null")
@Override @Override
public void initialize() { public void initialize() {
this.config = getConfigAs(BuienradarConfiguration.class); this.config = getConfigAs(BuienradarConfiguration.class);
@ -127,12 +126,19 @@ public class BuienradarHandler extends BaseThingHandler {
return; return;
} }
try { try {
@SuppressWarnings("null")
final Optional<List<Prediction>> predictionsOpt = client.getPredictions(location); final Optional<List<Prediction>> predictionsOpt = client.getPredictions(location);
if (!predictionsOpt.isPresent()) { if (!predictionsOpt.isPresent()) {
// Did not get a result, retry the retrieval. // Did not get a result, retry the retrieval.
logger.warn("Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.", // Buienradar is not a very stable source and returns nothing quite regular
tries, retryInSeconds); if (tries <= 2) {
logger.warn(
"Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.",
tries, retryInSeconds);
} else {
logger.debug(
"Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.",
tries, retryInSeconds);
}
scheduler.schedule(() -> refresh(tries - 1, nextRefresh, retryInSeconds * 2), retryInSeconds, scheduler.schedule(() -> refresh(tries - 1, nextRefresh, retryInSeconds * 2), retryInSeconds,
TimeUnit.SECONDS); TimeUnit.SECONDS);
return; return;
@ -164,7 +170,6 @@ public class BuienradarHandler extends BaseThingHandler {
} }
} }
@SuppressWarnings("null")
@Override @Override
public void dispose() { public void dispose() {
try { try {

View File

@ -143,7 +143,7 @@ public class BuienradarPredictionAPI implements PredictionAPI {
try { try {
result = HttpUtil.executeUrl("GET", address, TIMEOUT_MS); result = HttpUtil.executeUrl("GET", address, TIMEOUT_MS);
} catch (IOException e) { } catch (IOException e) {
logger.warn("IO Exception when trying to retrieve Buienradar results", e); logger.debug("IO Exception when trying to retrieve Buienradar results: {}", e.getMessage());
return Optional.empty(); return Optional.empty();
} }

View File

@ -60,10 +60,10 @@
</parameter> </parameter>
<parameter name="exponentialBackoffRetryBaseInSeconds" type="integer" required="true" min="1" unit="s"> <parameter name="exponentialBackoffRetryBaseInSeconds" type="integer" required="true" min="1" unit="s">
<label>Exponential Backoff Base for Retries</label> <label>Doubling Backoff Base for Retries</label>
<description>Exponential back-off base value for retries in seconds. For example, when this is 2 seconds, will retry <description>Doubling back-off base value for retries in seconds. For example, when this is 30 seconds, will retry
at 2, 4, 8, 16, 32, 64 seconds.</description> at 30, 60, 120, 240 seconds.</description>
<default>5</default> <default>30</default>
</parameter> </parameter>
</config-description> </config-description>