Protect against nil messages, which happen very infrequently.#82
Conversation
|
The only explanation I have for nil messages is the channel being closed outside of the consumers control, after which we end up reading zero values from the channel. What do you think of this: case messages, ok <- message:
if ok {
lastOffset = message.Offset
else {
// log something
}This would only protect against this particular case instead of |
|
I'm confused. Your counter proposal is to use: |
|
ping? Your proposal doesn't compile: Further, even if the send succeeds (ok == true), it may still succeed with a nil message, and we'll then still redirect through nil causing a NPE. |
|
[[Adding a log message is easy..]] |
The root cause of nil messages has not been diagnosed. Run "go fmt"
98263d5 to
2027a51
Compare
The root cause of nil messages has not been diagnosed.
Run "go fmt"