ws error printing improvement
* limit to 3 messages per second * print size when alloc failed
This commit is contained in:
@@ -215,7 +215,11 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
|
|||||||
if ((bufSize < 1) || (used < 1)) return(false); // WLEDMM should not happen
|
if ((bufSize < 1) || (used < 1)) return(false); // WLEDMM should not happen
|
||||||
AsyncWebSocketBuffer wsBuf(bufSize);
|
AsyncWebSocketBuffer wsBuf(bufSize);
|
||||||
if (!wsBuf) {
|
if (!wsBuf) {
|
||||||
USER_PRINTLN(F("WS buffer allocation failed."));
|
static unsigned long last_err_time = 0;
|
||||||
|
if (millis() - last_err_time > 300) { // WLEDMM limit to 3 messages per second
|
||||||
|
USER_PRINTF("WS buffer allocation failed (!wsBuf %u bytes).\n", bufSize);
|
||||||
|
last_err_time = millis();
|
||||||
|
}
|
||||||
errorFlag = ERR_LOW_WS_MEM;
|
errorFlag = ERR_LOW_WS_MEM;
|
||||||
return false; //out of memory
|
return false; //out of memory
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user