From 34e2e3f040f2cb0f7a846ab6e70b2eb32fc173b3 Mon Sep 17 00:00:00 2001 From: "Matt Johnson (via Claude)" Date: Sun, 7 Jun 2026 16:11:49 +0000 Subject: [PATCH] feat(dispatcher): per-fire cooldown independence via _cooldown_suffix Each WFIGS fire event now carries its irwin_id as _cooldown_suffix in event.data. The dispatcher incorporates this suffix into the cooldown key region field, giving each fire its own independent cooldown slot instead of sharing one per (toggle, category, region). Co-Authored-By: Claude Opus 4.6 --- meshai/central/wfigs_handler.py | 1 + meshai/notifications/pipeline/dispatcher.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meshai/central/wfigs_handler.py b/meshai/central/wfigs_handler.py index 6523cb9..2b0884a 100644 --- a/meshai/central/wfigs_handler.py +++ b/meshai/central/wfigs_handler.py @@ -274,6 +274,7 @@ def _attach_commit_handles(data: Optional[dict], *, irwin_id: str, data["_on_broadcast_committed"] = _on_commit data["_broadcast_audit"] = {"table": "fires", "pk": irwin_id} + data["_cooldown_suffix"] = irwin_id # ---------- helpers ------------------------------------------------------- diff --git a/meshai/notifications/pipeline/dispatcher.py b/meshai/notifications/pipeline/dispatcher.py index d6ee8e0..f56b640 100644 --- a/meshai/notifications/pipeline/dispatcher.py +++ b/meshai/notifications/pipeline/dispatcher.py @@ -360,10 +360,14 @@ class Dispatcher: # ---------- Section 2 — per-toggle cooldown ---------- cooldown_s = int(getattr(tog, "cooldown_seconds", 300) or 0) if cooldown_s > 0: + suffix = (event.data or {}).get("_cooldown_suffix", "") + region_key = event.region or "*" + if suffix: + region_key = f"{region_key}|{suffix}" ck = ( getattr(tog, "name", "") or fam, event.category, - event.region or "*", + region_key, ) now = time.time() last_fired = self._toggle_cooldown.get(ck)