Preventing Duplicate Push Notifications When Background Jobs Retry
Notification systems must account for task queues that typically offer at-least-once execution, since retries can cause customers to receive repeated messages. To stop two workers from sending the same campaign, the approach locks the campaign row and moves it to a sending status within a single database transaction, so only the worker that claims it proceeds. Targets are built from active, validated device tokens with duplicates removed, and each delivery is recorded under a deterministic key with a unique constraint before the push provider is called. Delivery records track pending, accepted, and failed outcomes, and campaign totals are derived from these rows rather than optimistic counts. The result is that each campaign-device pair is submitted at most once within the application's own retry model, though exactly-once delivery cannot be guaranteed across every external push platform.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in