Suhas Karanth
03/27/2025, 6:18 AMConsumer.Chan() for reading messages, how will I come to know if the consumer is closed?RunLLM
03/27/2025, 6:18 AMConsumer.Chan() to read messages, the channel will be closed when the consumer is closed. This means that you can detect the closure of the consumer by checking if the channel is closed. When the channel is closed, the range loop over the channel will exit, indicating that the consumer has been closed.
According to the GitHub issue, there was a discussion about closing the consumer's message channel when the consumer is closed to prevent goroutine leaks. This behavior ensures that when the consumer is closed, the channel is also closed, allowing you to detect the closure by monitoring the channel.
Would you like more details on how to implement this in your code?
Sources:
- GitHub issue 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.