rabbitmq-stream-go-client icon indicating copy to clipboard operation
rabbitmq-stream-go-client copied to clipboard

Close channels inside a `Once` and don't set channels to `nil`

Open Zerpet opened this issue 1 year ago • 0 comments

https://github.com/rabbitmq/rabbitmq-stream-go-client/blob/80ec3cc3d49b88fb3f11393daa403055cba269c5/pkg/raw/client.go#L684-L697

Setting the channel to nil comes at a risk of blocking infinitely if any receiver attempts to receive.

Receiving from a nil channel blocks forever.

https://go.dev/ref/spec#Receive_operator

It probably does not block inside the smart layer, but this is an unnecesary risk, when there's another option available to achieve idempotent shutdown()

Zerpet avatar Oct 26 '23 13:10 Zerpet