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

AutorecoveringModel.IsClosed should return true if model is unusable #1179

Merged

Conversation

onematchfox
Copy link
Contributor

Port of #1174 for main branch.

Side note/FYI: Commit on #1174 can be cherry-picked/backported to 7.x.

Proposed Changes

As per the description of IsClosed on IModel.cs, this property should

return[s] true if the model is no longer in a state where it can be used

At present this returns false if the _delegate has been disposed of which, I would say indicates that the model "is no longer in a state where it can be used".

Fixes (copy-paste?) regression introduced as part of 54f7840 by aligning the behaviour of IsClosed with the underlying implementation that would have been called were the delegate not disposed of.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

If approved then the same change will need to be applied to main although the commit in this PR can't be simply cherry-picked across. Let me know if you'd like me to submit a separate PR for this or if one of the maintainers will handle this.

As per the description of [`IsClosed` on `IModel.cs`](https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/4d624be819061c9272c406a7c5250ee24eaa759f/projects/RabbitMQ.Client/client/api/IModel.cs#L85-L88), this property should "return[s] true if the model is no longer in a state where it can be used". At present this returns `false` if the `_delegate` has been disposed of - which I would say indicates that the model "is no longer in a state where it can be used".

Fixes regression introduced as part of rabbitmq@54f7840 by aligning the behaviour of `IsClosed` with the underlying [implementation](https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/c9201e4f4ffb62206ca9c7bbca76ea68fe24345f/projects/RabbitMQ.Client/client/impl/ModelBase.cs#L161-L164) that would have been called were the delegate not disposed of.
@michaelklishin michaelklishin merged commit bb84da0 into rabbitmq:main Mar 10, 2022
@onematchfox onematchfox deleted the fix/autorecoveringmodel-isclosed branch March 11, 2022 08:45
@lukebakken lukebakken added this to the 7.0.0 milestone Mar 14, 2022
@lukebakken lukebakken self-assigned this Mar 14, 2022
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.

3 participants