Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection: clarify documented behavior of NotifyClose #13

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

pabigot
Copy link
Contributor

@pabigot pabigot commented Aug 30, 2021

The documentation for NotifyClose() differs between Channel:

The chan provided will be closed when the Channel is closed and on a graceful close, no error will be sent.

and Connection:

On normal shutdowns, the chan will be closed.

The latter wording suggests that on abnormal shutdowns the chan will remain open, with two expected features:

  • A non-blocking chan could be registered and the error notification would still be available to the application; and
  • a new Connection could pass that same chan to NotifyClose() so an existing select statement need not update the chan it monitors.

In fact the logic for maintaining close notifiers appears identical for both Channel and Connection: both are closed as a result of the underlying object being closed.

This PR updates to use the Channel description in the Connection function to avoid the misleading interpretation.

Use the wording from Channel.NotifyClose, which does not allow an
interpretation that the notifier chan can continue to be used after an
abnormal close.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
@ChunyiLyu ChunyiLyu merged commit bb8191b into rabbitmq:main Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants