From 6cfb0ae975ad17a88f3533b5054c08023426d74f Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 23 Nov 2023 09:19:17 -0800 Subject: [PATCH] https://telecominfraproject.atlassian.net/browse/WIFI-13147 Signed-off-by: stephb9959 --- src/AP_WS_Server.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/AP_WS_Server.cpp b/src/AP_WS_Server.cpp index c7ff4b95..d85ce566 100644 --- a/src/AP_WS_Server.cpp +++ b/src/AP_WS_Server.cpp @@ -176,13 +176,17 @@ namespace OpenWifi { auto now = Utils::Now(); { - if (!Garbage_.empty()) { - Garbage_.clear(); + { + std::lock_guard L1(WSServerMutex_); + if (!Garbage_.empty()) { + Garbage_.clear(); + } } uint64_t total_connected_time = 0; - if(now-last_zombie_run > 60) { + if(now-last_zombie_run > 20) { + poco_information(Logger(), fmt::format("Garbage collecting...")); std::vector SessionsToRemove; NumberOfConnectedDevices_ = 0; NumberOfConnectingDevices_ = 0; @@ -227,6 +231,7 @@ namespace OpenWifi { AverageDeviceConnectionTime_ = NumberOfConnectedDevices_ > 0 ? total_connected_time / NumberOfConnectedDevices_ : 0; + poco_information(Logger(), fmt::format("Garbage collecting done...")); } else { NumberOfConnectedDevices_ = SerialNumbers_.size(); AverageDeviceConnectionTime_ += 10;