parent
4548fc2a00
commit
65319ed07e
@ -68,6 +68,14 @@ void WebApiWsLiveClass::loop()
|
||||
try {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
DynamicJsonDocument root(4200 * INV_MAX_COUNT); // TODO(helge) check if this calculation is correct
|
||||
|
||||
// TODO(helge) temporary dump of memory usage if allocation of DynamicJsonDocument fails (will be fixed in upstream repo)
|
||||
if (root.capacity() == 0) {
|
||||
MessageOutput.printf("Calling /api/livedata/status has temporarily run out of resources. Reason: Alloc memory for DynamicJsonDocument failed (FreeHeap = %d, MaxAllocHeap = %d, MinFreeHeap = %d).\r\n", ESP.getFreeHeap(), ESP.getMaxAllocHeap(), ESP.getMinFreeHeap());
|
||||
_lastWsPublish = millis();
|
||||
return;
|
||||
}
|
||||
|
||||
JsonVariant var = root;
|
||||
generateJsonResponse(var);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user