LiveService if out of ressources close websocket
This commit is contained in:
parent
0f80a25937
commit
a758d894f6
@ -59,7 +59,7 @@ void WebApiWsLiveClass::loop()
|
||||
|
||||
// Update on every inverter change or at least after 10 seconds
|
||||
if (millis() - _lastWsPublish > (10 * 1000) || (maxTimeStamp != _newestInverterTimestamp)) {
|
||||
|
||||
try {
|
||||
DynamicJsonDocument root(40960);
|
||||
JsonVariant var = root;
|
||||
generateJsonResponse(var);
|
||||
@ -79,6 +79,10 @@ void WebApiWsLiveClass::loop()
|
||||
|
||||
_lastWsPublish = millis();
|
||||
}
|
||||
catch (std::bad_alloc& bad_alloc) {
|
||||
MessageOutput.printf("Call to /api/livedata/status temporarely out of resources. Reason: \"%s\".", bad_alloc.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
|
||||
|
||||
@ -55,7 +55,7 @@ void WebApiWsVedirectLiveClass::loop()
|
||||
|
||||
// Update on ve.direct change or at least after 10 seconds
|
||||
if (millis() - _lastWsPublish > (10 * 1000) || (maxTimeStamp != _newestVedirectTimestamp)) {
|
||||
|
||||
try {
|
||||
DynamicJsonDocument root(1024);
|
||||
JsonVariant var = root;
|
||||
generateJsonResponse(var);
|
||||
@ -75,6 +75,10 @@ void WebApiWsVedirectLiveClass::loop()
|
||||
|
||||
_lastWsPublish = millis();
|
||||
}
|
||||
catch (std::bad_alloc& bad_alloc) {
|
||||
MessageOutput.printf("Call to /api/vedirectlivedata/status temporarely out of resources. Reason: \"%s\".", bad_alloc.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebApiWsVedirectLiveClass::generateJsonResponse(JsonVariant& root)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user