mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: skip formatting request timings that won't be logged
timeRequest built both 112-byte descriptions (with a String copy of the URL) on async_tcp for every request, and logElapsed threw them away for anything under 100ms. Check worthLogging() first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9988a2bec8
commit
6a3769406f
4 changed files with 28 additions and 3 deletions
|
|
@ -1300,17 +1300,21 @@ static void timeRequest(AsyncWebServerRequest *request, ArMiddlewareNext next, c
|
|||
// this runs, and replacing it would stop the reboot after an update.
|
||||
if(!request->multipart()) {
|
||||
request->onDisconnect([request, timer, server, ip]() {
|
||||
const uint32_t us = timer.us();
|
||||
if(!worthLogging(us)) return;
|
||||
char what[112];
|
||||
snprintf(what, sizeof(what), "%s %s %s from %u.%u.%u.%u total", server, request->methodToString(), request->url().c_str(),
|
||||
ip[0], ip[1], ip[2], ip[3]);
|
||||
logElapsed(TAG, what, timer.us());
|
||||
logElapsed(TAG, what, us);
|
||||
});
|
||||
}
|
||||
next();
|
||||
const uint32_t us = timer.us();
|
||||
if(!worthLogging(us)) return;
|
||||
char what[112];
|
||||
snprintf(what, sizeof(what), "%s %s %s from %u.%u.%u.%u handler", server, request->methodToString(), request->url().c_str(),
|
||||
ip[0], ip[1], ip[2], ip[3]);
|
||||
logElapsed(TAG, what, timer.us());
|
||||
logElapsed(TAG, what, us);
|
||||
}
|
||||
|
||||
void Web::begin() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue