mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[buienradar] Avoid to much log noise (#9804)
Signed-off-by: Björn Brings <bjoernbrings@web.de>
This commit is contained in:
parent
3c27aeb621
commit
c341c509b1
@ -76,7 +76,6 @@ public class BuienradarHandler extends BaseThingHandler {
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Override
|
||||
public void initialize() {
|
||||
this.config = getConfigAs(BuienradarConfiguration.class);
|
||||
@ -127,12 +126,19 @@ public class BuienradarHandler extends BaseThingHandler {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@SuppressWarnings("null")
|
||||
final Optional<List<Prediction>> predictionsOpt = client.getPredictions(location);
|
||||
if (!predictionsOpt.isPresent()) {
|
||||
// Did not get a result, retry the retrieval.
|
||||
logger.warn("Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.",
|
||||
tries, retryInSeconds);
|
||||
// Buienradar is not a very stable source and returns nothing quite regular
|
||||
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,
|
||||
TimeUnit.SECONDS);
|
||||
return;
|
||||
@ -164,7 +170,6 @@ public class BuienradarHandler extends BaseThingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Override
|
||||
public void dispose() {
|
||||
try {
|
||||
|
@ -143,7 +143,7 @@ public class BuienradarPredictionAPI implements PredictionAPI {
|
||||
try {
|
||||
result = HttpUtil.executeUrl("GET", address, TIMEOUT_MS);
|
||||
} 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();
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,10 @@
|
||||
</parameter>
|
||||
|
||||
<parameter name="exponentialBackoffRetryBaseInSeconds" type="integer" required="true" min="1" unit="s">
|
||||
<label>Exponential Backoff Base for Retries</label>
|
||||
<description>Exponential back-off base value for retries in seconds. For example, when this is 2 seconds, will retry
|
||||
at 2, 4, 8, 16, 32, 64 seconds.</description>
|
||||
<default>5</default>
|
||||
<label>Doubling Backoff Base for Retries</label>
|
||||
<description>Doubling back-off base value for retries in seconds. For example, when this is 30 seconds, will retry
|
||||
at 30, 60, 120, 240 seconds.</description>
|
||||
<default>30</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user