Aktualisiere WebSocket-Server und Daemon-Konfiguration
- Ändere die Pfade für SSL-Zertifikate in der Konfigurationsdatei. - Verbessere die Fehlerbehandlung beim Entfernen alter vorbereiteter Anweisungen in HouseWorker. - Füge Debug-Ausgaben zur Nachverfolgung von Verbindungen und Nachrichten im WebSocket-Server hinzu. - Implementiere Timeout-Logik für das Stoppen von Worker- und Watchdog-Threads. - Optimiere die Signalverarbeitung und Shutdown-Logik in main.cpp für bessere Responsivität.
This commit is contained in:
committed by
Torsten (PC)
parent
8fe816dddc
commit
bd961a03d4
@@ -13,20 +13,25 @@ ProduceWorker::~ProduceWorker() {
|
||||
|
||||
void ProduceWorker::run() {
|
||||
auto lastIterationTime = std::chrono::steady_clock::now();
|
||||
while (runningWorker) {
|
||||
while (runningWorker.load()) {
|
||||
setCurrentStep("Check runningWorker Variable");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(activityMutex);
|
||||
if (!runningWorker) {
|
||||
break;
|
||||
}
|
||||
if (!runningWorker.load()) {
|
||||
break;
|
||||
}
|
||||
|
||||
setCurrentStep("Calculate elapsed time");
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastIterationTime);
|
||||
if (elapsed < std::chrono::milliseconds(200)) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200) - elapsed);
|
||||
// Kürzere Sleep-Intervalle für bessere Shutdown-Responsivität
|
||||
auto sleepTime = std::chrono::milliseconds(200) - elapsed;
|
||||
for (int i = 0; i < sleepTime.count() && runningWorker.load(); i += 10) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
}
|
||||
|
||||
if (!runningWorker.load()) break;
|
||||
|
||||
lastIterationTime = std::chrono::steady_clock::now();
|
||||
setCurrentStep("Process Productions");
|
||||
processProductions();
|
||||
|
||||
Reference in New Issue
Block a user