Set explicit timeout for http request (#15505)
* Bondhome * chatgpt * electroluxair * energidataservice * freeboxos * gardena * generacmobilelink * hdpowerview * icalendar * juicenet * kostalinverter * liquidcheck * mcd * meater * miele * mercedesme * mybmw * myq * ojelectronics * plex * radiothermostat * renault * semsportal * sensibo * tapocontrol * tellstick * verisure * vizio --------- Signed-off-by: lsiepel <leosiepel@gmail.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import static org.openhab.binding.tapocontrol.internal.constants.TapoBindingSett
|
||||
import static org.openhab.binding.tapocontrol.internal.constants.TapoErrorCode.*;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -213,6 +214,7 @@ public class TapoCloudConnector {
|
||||
@Nullable
|
||||
protected ContentResponse sendCloudRequest(String url, String payload) {
|
||||
Request httpRequest = httpClient.newRequest(url).method(HttpMethod.POST.toString());
|
||||
httpRequest.timeout(TAPO_HTTP_CLOUD_TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||
|
||||
/* set header */
|
||||
httpRequest.header("content-type", CONTENT_TYPE_JSON);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class TapoBindingSettings {
|
||||
public static final Integer HTTP_MAX_CONNECTIONS = 10; // setMaxConnectionsPerDestination for HTTP-Client
|
||||
public static final Integer HTTP_MAX_QUEUED_REQUESTS = 10; // setMaxRequestsQueuedPerDestination for HTTP-Client
|
||||
public static final Integer TAPO_HTTP_TIMEOUT_MS = 5000; // http request timeout
|
||||
public static final Integer TAPO_HTTP_CLOUD_TIMEOUT_MS = 10000; // http request cloud timeout
|
||||
public static final Integer TAPO_PING_TIMEOUT_MS = 2000; // ping timeout
|
||||
public static final Integer TAPO_REFRESH_MIN_GAP_MS = 5000; // min gap between sending refresh request
|
||||
public static final Integer TAPO_SEND_MIN_GAP_MS = 1000; // min gap between sending command request
|
||||
|
||||
Reference in New Issue
Block a user