]> git.basschouten.com Git - openhab-addons.git/commitdiff
[innogysmarthome] Fix - No commands can get executed after a few minutes (#8742)
authorSven Strohschein <novanic@gmx.de>
Tue, 13 Oct 2020 17:40:03 +0000 (19:40 +0200)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 17:40:03 +0000 (10:40 -0700)
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
bundles/org.openhab.binding.innogysmarthome/src/main/java/org/openhab/binding/innogysmarthome/internal/client/InnogyClient.java

index 177ee4769b246761b35e109204a26424f66224d8..f8fedf26f03eafc02cf0ac6bd5a5e0427b17be7e 100644 (file)
@@ -79,9 +79,11 @@ import com.google.gson.JsonSyntaxException;
  */
 @NonNullByDefault
 public class InnogyClient {
+
     private static final String BEARER = "Bearer ";
     private static final String CONTENT_TYPE = "application/json";
-    private static final int HTTP_CLIENT_TIMEOUT_SECONDS = 10;
+    private static final int HTTP_REQUEST_TIMEOUT_SECONDS = 10;
+    private static final int HTTP_REQUEST_IDLE_TIMEOUT_SECONDS = 20;
 
     private final Logger logger = LoggerFactory.getLogger(InnogyClient.class);
 
@@ -185,7 +187,8 @@ public class InnogyClient {
 
             response = request.header(HttpHeader.ACCEPT, CONTENT_TYPE)
                     .header(HttpHeader.AUTHORIZATION, BEARER + accessTokenResponse.getAccessToken())
-                    .timeout(HTTP_CLIENT_TIMEOUT_SECONDS, TimeUnit.SECONDS).send();
+                    .idleTimeout(HTTP_REQUEST_IDLE_TIMEOUT_SECONDS, TimeUnit.SECONDS)
+                    .timeout(HTTP_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS).send();
         } catch (InterruptedException | TimeoutException | ExecutionException e) {
             throw new IOException(e);
         }