stephb9959
2022-09-29 12:31:30 -07:00
parent 82688aa4ca
commit c31ea8f632
3 changed files with 17 additions and 9 deletions

2
build
View File

@@ -1 +1 @@
124 125

View File

@@ -130,6 +130,16 @@ namespace OpenWifi {
fmt::format("Outstanding-requests {}", OutStandingRequests_.size())); fmt::format("Outstanding-requests {}", OutStandingRequests_.size()));
} }
bool CommandManager::IsCommandRunning(const std::string &C) {
std::shared_lock Lock(LocalMutex_);
for (const auto &request : OutStandingRequests_) {
if (request.second.UUID == C) {
return true;
}
}
return false;
}
void CommandManager::onCommandRunnerTimer([[maybe_unused]] Poco::Timer &timer) { void CommandManager::onCommandRunnerTimer([[maybe_unused]] Poco::Timer &timer) {
Utils::SetThreadName("cmd:schdlr"); Utils::SetThreadName("cmd:schdlr");
Poco::Logger &MyLogger = Poco::Logger::get("CMD-MGR-SCHEDULER"); Poco::Logger &MyLogger = Poco::Logger::get("CMD-MGR-SCHEDULER");
@@ -153,14 +163,10 @@ namespace OpenWifi {
MyLogger, fmt::format("{}: Serial={} Command={} Starting processing.", MyLogger, fmt::format("{}: Serial={} Command={} Starting processing.",
Cmd.UUID, Cmd.SerialNumber, Cmd.Command)); Cmd.UUID, Cmd.SerialNumber, Cmd.Command));
try { try {
{
std::shared_lock Lock(LocalMutex_); // Skip an already running command
for (const auto &request : OutStandingRequests_) { if(IsCommandRunning(Cmd.UUID))
if (request.second.UUID == Cmd.UUID) { continue;
continue;
}
}
}
auto now = OpenWifi::Now(); auto now = OpenWifi::Now();
// 2 hour timeout for commands // 2 hour timeout for commands

View File

@@ -132,6 +132,8 @@ namespace OpenWifi {
false, Sent ); false, Sent );
} }
bool IsCommandRunning(const std::string &C);
void run() override; void run() override;
static auto instance() { static auto instance() {