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

Unify on IModel #858

Merged
merged 2 commits into from
Jul 7, 2020
Merged

Conversation

danielmarbach
Copy link
Collaborator

Proposed Changes

The worker service did mostly use IModel exception when the model was added with safely casted it to ModelBase but never actually verified if the model implements ModelBase. Any model not deriving from ModelBase would cause a NullRef. Given that the ModelBase method is only used in the exception case I moved the conversion to ModelBase into the worker implementation.

Of course this change has the tradeoff of making now everything an interface dispatch as was as safe casting on the exception path (which is slow anyway) so I'll leave it up to you if you think this is good or not. I'd suggest though if this PR is not taken to throw a meaningful exception if the model cannot be converted to model base.

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

@@ -18,12 +18,12 @@ sealed class BasicDeliver : Work
readonly IBasicProperties _basicProperties;
readonly ReadOnlyMemory<byte> _body;

public BasicDeliver(IBasicConsumer consumer,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to roll back if you want to keep the white space

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, turning down a PR because of a single whitespace change sounds unreasonable :)

@michaelklishin
Copy link
Member

@danielmarbach the callback exception path should not generally be executed very often. However, maybe we should borrow a complete enough (using real publishers and consumers) benchmark from one of the recent PRs to have some data to make a more informed decision?

Just curious, was some kind of mock implementation of IModel used in your case?

@danielmarbach
Copy link
Collaborator Author

danielmarbach commented Jun 2, 2020

No mock. I looked at it from a more open/close and liskov principle. I'm not disappointed if this is thrown away and I also don't want to spend too much time on this. For the recent ping I had to dig into the worker services and I found this weird state of IModel vs ModelBase. Given I found no guidance which one should be defacto standard I figured I send in a suggestion that uses the most abstract one which is the interface

@danielmarbach
Copy link
Collaborator Author

Any thoughts on this, is it worth a rebase or not?

Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this change makes sense.

@lukebakken lukebakken added this to the 6.2.0 milestone Jul 7, 2020
@lukebakken lukebakken self-assigned this Jul 7, 2020
@danielmarbach
Copy link
Collaborator Author

Ok rebased

@michaelklishin michaelklishin merged commit 16560f2 into rabbitmq:master Jul 7, 2020
@michaelklishin
Copy link
Member

@danielmarbach can you please submit this based on the 6.x branch? There are conflicts that are not obvious to me.

@michaelklishin michaelklishin modified the milestones: 6.2.0, 7.0.0 Jul 7, 2020
@danielmarbach danielmarbach deleted the unify-onmodel branch July 7, 2020 18:10
@danielmarbach
Copy link
Collaborator Author

Here we go #898

@lukebakken lukebakken modified the milestones: 8.0.0, 7.0.0 Mar 8, 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