Closed CxdInitial closed 4 years ago
go-nsq
expects that a consumer will "finish" all messages in flight, eventually, in order to close cleanly.
The edge case you describe is effectively a consumer that does not respond to all of its in-flight messages.
If the read in
readLoop
failed (error occurs), when exitingmessagesInFlight
is positive,readLoop
do nothing.closeFlag
is zero. https://github.com/nsqio/go-nsq/blob/61f49c096d0d767be61e4de06f724e1cb5fd85d7/conn.go#L543-L552But what if the write in
writeLoop
just works (no error), and eventually it will block forever . The logic below won't be executed. https://github.com/nsqio/go-nsq/blob/61f49c096d0d767be61e4de06f724e1cb5fd85d7/conn.go#L595-L599 https://github.com/nsqio/go-nsq/blob/61f49c096d0d767be61e4de06f724e1cb5fd85d7/conn.go#L588-L593 https://github.com/nsqio/go-nsq/blob/61f49c096d0d767be61e4de06f724e1cb5fd85d7/conn.go#L564-L569