[innogysmarthome] Fix - No commands can get executed after a few minutes (#8742)

Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
This commit is contained in:
Sven Strohschein 2020-10-13 19:40:03 +02:00 committed by GitHub
parent ee92be3f9f
commit a12e5f60ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -79,9 +79,11 @@ import com.google.gson.JsonSyntaxException;
*/ */
@NonNullByDefault @NonNullByDefault
public class InnogyClient { public class InnogyClient {
private static final String BEARER = "Bearer "; private static final String BEARER = "Bearer ";
private static final String CONTENT_TYPE = "application/json"; 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); private final Logger logger = LoggerFactory.getLogger(InnogyClient.class);
@ -185,7 +187,8 @@ public class InnogyClient {
response = request.header(HttpHeader.ACCEPT, CONTENT_TYPE) response = request.header(HttpHeader.ACCEPT, CONTENT_TYPE)
.header(HttpHeader.AUTHORIZATION, BEARER + accessTokenResponse.getAccessToken()) .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) { } catch (InterruptedException | TimeoutException | ExecutionException e) {
throw new IOException(e); throw new IOException(e);
} }