mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-30 17:07:16 +02:00
Merge pull request #282 from airgradienthq/fix/extend-connect-timeout
HTTP client failed/timeout to establish connection to airgradient server
This commit is contained in:
@ -58,7 +58,8 @@ bool AgApiClient::fetchServerConfiguration(void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HTTPClient client;
|
HTTPClient client;
|
||||||
client.setTimeout(timeoutMs);
|
client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server
|
||||||
|
client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server
|
||||||
if (apiRootChanged) {
|
if (apiRootChanged) {
|
||||||
// If apiRoot is changed, assume not using https
|
// If apiRoot is changed, assume not using https
|
||||||
if (client.begin(uri) == false) {
|
if (client.begin(uri) == false) {
|
||||||
@ -133,7 +134,8 @@ bool AgApiClient::postToServer(String data) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HTTPClient client;
|
HTTPClient client;
|
||||||
client.setTimeout(timeoutMs);
|
client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server
|
||||||
|
client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server
|
||||||
if (apiRootChanged) {
|
if (apiRootChanged) {
|
||||||
// If apiRoot is changed, assume not using https
|
// If apiRoot is changed, assume not using https
|
||||||
if (client.begin(uri) == false) {
|
if (client.begin(uri) == false) {
|
||||||
|
@ -31,7 +31,7 @@ private:
|
|||||||
bool getConfigFailed;
|
bool getConfigFailed;
|
||||||
bool postToServerFailed;
|
bool postToServerFailed;
|
||||||
bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard.
|
bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard.
|
||||||
uint16_t timeoutMs = 10000; // Default set to 10s
|
uint16_t timeoutMs = 15000; // Default set to 15s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AgApiClient(Stream &stream, Configuration &config);
|
AgApiClient(Stream &stream, Configuration &config);
|
||||||
|
Reference in New Issue
Block a user