feat(scheduler): job dedupe flag for webhooks that must not collapse

This commit is contained in:
hh
2026-08-29 22:15:15 +02:00
parent 2d12391176
commit b4853b9fd0
+3 -2
View File
@@ -58,6 +58,7 @@ class Job:
webhook: bool = False webhook: bool = False
events: tuple[str, ...] = () events: tuple[str, ...] = ()
critical: bool = True critical: bool = True
dedupe: bool = True
@property @property
def entrypoint(self) -> str: def entrypoint(self) -> str:
@@ -297,8 +298,8 @@ class Scheduler:
ids = await self._queries.enqueue( ids = await self._queries.enqueue(
job.entrypoint, job.entrypoint,
_encode({**payload, "trigger": "webhook"}), _encode({**payload, "trigger": "webhook"}),
dedupe_key=f"hook:{name}", dedupe_key=f"hook:{name}" if job.dedupe else None,
on_conflict="skip", on_conflict="skip" if job.dedupe else "raise",
) )
return int(ids[0]) if ids and ids[0] is not None else None return int(ids[0]) if ids and ids[0] is not None else None