Fix: Workaround: Don't allow memory intensive web functions in parallel
Somehow the API has to be adjusted to reduce memory consumption. For now lets just prevent both methods to allocate memory at the same time.
This commit is contained in:
parent
2c41be106e
commit
b34b22c658
@ -25,4 +25,6 @@ private:
|
||||
uint32_t _lastInvUpdateCheck = 0;
|
||||
uint32_t _lastWsCleanup = 0;
|
||||
uint32_t _newestInverterTimestamp = 0;
|
||||
|
||||
std::mutex _mutex;
|
||||
};
|
||||
@ -62,7 +62,8 @@ void WebApiWsLiveClass::loop()
|
||||
if (millis() - _lastWsPublish > (10 * 1000) || (maxTimeStamp != _newestInverterTimestamp)) {
|
||||
|
||||
try {
|
||||
DynamicJsonDocument root(40960);
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
DynamicJsonDocument root(4096 * INV_MAX_COUNT);
|
||||
JsonVariant var = root;
|
||||
generateJsonResponse(var);
|
||||
|
||||
@ -221,7 +222,8 @@ void WebApiWsLiveClass::onLivedataStatus(AsyncWebServerRequest* request)
|
||||
}
|
||||
|
||||
try {
|
||||
AsyncJsonResponse* response = new AsyncJsonResponse(false, 40960U);
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
AsyncJsonResponse* response = new AsyncJsonResponse(false, 4096 * INV_MAX_COUNT);
|
||||
JsonVariant root = response->getRoot();
|
||||
|
||||
generateJsonResponse(root);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user