I'm using AWS ElastiCache in cluster mode and enabled the notification to EX. In dev env I'm getting 1 notification for each unique key expiry but in staging getting 2 notification per key expiry any config which I can change to get unique notification?
-
This is not about programming.Cow– Cow2025-11-19 07:36:50 +00:00Commented Nov 19 at 7:36
1 Answer
In Redis Cluster Mode, getting two expiry notifications is actually pretty common. It usually happens because your app ends up subscribing to more than one shard/node, so both nodes fire the same expiry event. Dev likely connects to only one shard, but staging doesn’t.
or or Other possible causes:
A recent failover or resharding (Redis may send events from both old and new masters)
Different persistence settings (AOF/RDB) causing events to replay
Differences in parameter groups between Dev and Staging
There’s no Redis or ElastiCache setting that guarantees “only one notification per key.” The reliable fix is to deduplicate on the consumer side, or ensure your app subscribes only once to the correct shard. Good Luck!
Thanks, Rajat Mishra