Carry completion timing under the lock; shut down before close

The completed event's was_on_time travels on the CompletionResult
(decided with the write) instead of re-reading latest state a racing
reversal could replace; unload clears coordinator listeners before
the database close.
This commit is contained in:
2026-09-19 13:29:25 -04:00
parent a65e32f577
commit 35e66bd9e6
5 changed files with 71 additions and 18 deletions
+6 -1
View File
@@ -317,7 +317,12 @@ def _complete_quest(
**_actor_kwargs(call),
)
if result.appended:
await fire_quest_completed(hass, runtime.database, instance_id)
await fire_quest_completed(
hass,
runtime.database,
instance_id,
was_on_time=result.was_on_time,
)
await _refresh_entities(runtime)
return _with_errors(_handler)