corvix.notifications.dedupe

Idempotency / deduplication helpers for notification delivery.

Functions

dedupe_events(...)

Filter events to those not already in seen.

make_seen_set(→ set[str])

Build an initial seen set from a list of already-delivered events.

Module Contents

corvix.notifications.dedupe.dedupe_events(events: list[corvix.notifications.models.NotificationEvent], seen: set[str]) tuple[list[corvix.notifications.models.NotificationEvent], set[str]][source][source]

Filter events to those not already in seen.

Returns a tuple of (fresh_events, updated_seen_set). The returned set is a new object; the caller should replace their reference so the state advances correctly across poll cycles.

Parameters

events:

Candidate events from the current poll cycle.

seen:

Set of event_id values already delivered in previous cycles.

corvix.notifications.dedupe.make_seen_set(events: list[corvix.notifications.models.NotificationEvent]) set[str][source][source]

Build an initial seen set from a list of already-delivered events.