KamoCRM

Atomic claim before lead creation — prevent orphan pooled leads

FixSecurityService
Shipped
3 ஜூலை, 2026 அன்று 3:37 AM UTC
Author
Kamo
Commit
7dae7d3

social.lead.new can be processed concurrently (old + new SecurityService pod both hold a core-NATS subscription during a RollingUpdate → one publish delivered to both). The prior check-then-act idempotency test raced, letting the loser create a pooled lead with no SocialRemoteUserLead mapping (un-joinable social conversation). Now the unique (connectionId, remoteUserId) index is claimed via saveAndFlush BEFORE any lead is created; the loser skips, and a post-claim failure releases the claim for clean retry. Caught by Meta E2E.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing