Skip to content

Commit

Permalink
Improve handling of interrupted request by alllowing retries
Browse files Browse the repository at this point in the history
Rebased

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
  • Loading branch information
clinique committed Mar 25, 2024
1 parent 5f29f9f commit f7f7ee4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ public synchronized <T> T executeUri(URI uri, HttpMethod method, Class<T> clazz,
"@text/maximum-usage-reached [ \"%d\" ]".formatted(API_LIMIT_INTERVAL_S), null, null);
}
throw e;
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
// throw new NetatmoException("Request interrupted");
} catch (InterruptedException | TimeoutException | ExecutionException e) {
if (retryCount > 0) {
logger.debug("Request error, retry counter: {}", retryCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.openhab.binding.netatmo.internal.api.WeatherApi;
import org.openhab.binding.netatmo.internal.api.dto.NAObject;
import org.openhab.binding.netatmo.internal.handler.CommonInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* {@link WeatherCapability} give the ability to read weather station API
Expand All @@ -29,6 +31,7 @@
*/
@NonNullByDefault
public class WeatherCapability extends CacheWeatherCapability {
private final Logger logger = LoggerFactory.getLogger(WeatherCapability.class);

public WeatherCapability(CommonInterface handler) {
super(handler, Duration.ofSeconds(2));
Expand Down

0 comments on commit f7f7ee4

Please sign in to comment.