fix(B3): _honeymoon_expired Race-Schutz — prüft pending_status unter Lock

This commit is contained in:
Bernd (Hermes)
2026-07-24 17:06:01 +02:00
parent ad84f665bc
commit 3ef57653c9
+11
View File
@@ -322,6 +322,17 @@ class PresenceEngine:
active = self._active_tasks
if active == 0:
# B3: Race-Schutz — prüfe ob pending_status 'busy' ist.
# mark_busy_started könnte parallel update_presence() mit
# pending='busy' aufgerufen haben. Dann NICHT überschreiben.
with self._coalesce_lock:
pending = self._pending_status
if pending == "busy":
logger.debug(
"[presence] Honeymoon-Timer abgelaufen, aber pending_status=busy — "
"nicht überschreiben (Race-Schutz)"
)
return
# B2: Reset _busy_started_at when honeymoon fully expires
# and no active tasks remain — next busy cycle starts fresh.
self._busy_started_at = 0.0