🛠️ Fixes
-
Redis Streams PubSub CPU Busy-Spin — When the message buffer was full,
subscribeToStreamlooped at 100% CPU with no backoff becauseconsumeStreamMessagesreturned immediately on zero capacity. Added a
time.Afterbackoff using the existingsubscribeRetryInterval, following the same pattern used in the Subscribe connection-wait loop. -
Redis Streams Goroutine Leak on Shutdown — The subscription context created in
ensureSubscriptionwas discarded (_, cancel := ...) andrunSubscriptionLoopused a freshcontext.Background(), making
goroutines impossible to cancel. The cancelable context is now propagated through the full call chain, andClose()no longer holds the write lock while waiting for goroutines (which previously caused a
guaranteed 5-second deadlock on every shutdown). -
Redis Streams Reconnection Failure —
resubscribeAllwas silently a no-op for streams — it canceled a context nobody held and never started a new goroutine. It now properly waits for old goroutines to exit
and starts new ones with fresh contexts, preserving the consumer name across resubscribes to maintain PEL ownership and prevent message loss.