Better handling of out of memory situations in live data websocket
This commit is contained in:
parent
ca18d2c841
commit
ef9f0040e8
@ -6,6 +6,7 @@
|
|||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "Datastore.h"
|
#include "Datastore.h"
|
||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
|
#include "Utils.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
@ -64,11 +65,11 @@ void WebApiWsLiveClass::loop()
|
|||||||
try {
|
try {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::lock_guard<std::mutex> lock(_mutex);
|
||||||
DynamicJsonDocument root(4096 * INV_MAX_COUNT);
|
DynamicJsonDocument root(4096 * INV_MAX_COUNT);
|
||||||
|
if (Utils::checkJsonAlloc(root, __FUNCTION__, __LINE__)) {
|
||||||
JsonVariant var = root;
|
JsonVariant var = root;
|
||||||
generateJsonResponse(var);
|
generateJsonResponse(var);
|
||||||
|
|
||||||
String buffer;
|
String buffer;
|
||||||
if (buffer) {
|
|
||||||
serializeJson(root, buffer);
|
serializeJson(root, buffer);
|
||||||
|
|
||||||
if (Configuration.get().Security.AllowReadonly) {
|
if (Configuration.get().Security.AllowReadonly) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user