Instead of using Unbounded channels, add a cap for 1,000 messages in
the buffer. When the buffer is full, messages will be dropped. For this
to happen a connection in subscribe mode should have more than 1,000
other messages pending delivery. After that point, messages will be
dropped to avoid using too much memory.
In general it is a bad practice to have unlimited buffers lying around
in the codebase.
Instead of using Unbounded channels, add a cap for 1,000 messages in the buffer. When the buffer is full, messages will be dropped. For this to happen a connection in subscribe mode should have more than 1,000 other messages pending delivery. After that point, messages will be dropped to avoid using too much memory.
In general it is a bad practice to have unlimited buffers lying around in the codebase.