Shorten MQTT probe timeout to limit web server stalls
This commit is contained in:
+2
-1
@@ -13,6 +13,7 @@
|
||||
#define PWM_RES 10
|
||||
#define MQTT_MANUFACTURER "Baumann Enkataleiptics"
|
||||
#define AUTH_USERNAME "admin"
|
||||
#define MQTT_PROBE_TIMEOUT_MS 400 // keep short: blocks loop()/handleClient() per reconnect attempt
|
||||
|
||||
struct MeterConfig {
|
||||
int pin;
|
||||
@@ -340,7 +341,7 @@ static void mqttLoop() {
|
||||
if (now > mqttReconnectAt) {
|
||||
Serial.printf("[MQTT] probing %s:%d\n", mqttCfg.host, mqttCfg.port);
|
||||
WiFiClient probe;
|
||||
bool reachable = probe.connect(mqttCfg.host, mqttCfg.port, 1500);
|
||||
bool reachable = probe.connect(mqttCfg.host, mqttCfg.port, MQTT_PROBE_TIMEOUT_MS);
|
||||
probe.stop();
|
||||
|
||||
if (reachable) {
|
||||
|
||||
Reference in New Issue
Block a user