-
Notifications
You must be signed in to change notification settings - Fork 593
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
Unify on IModel #858
Conversation
@@ -18,12 +18,12 @@ sealed class BasicDeliver : Work | |||
readonly IBasicProperties _basicProperties; | |||
readonly ReadOnlyMemory<byte> _body; | |||
|
|||
public BasicDeliver(IBasicConsumer consumer, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
@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 |
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 |
Any thoughts on this, is it worth a rebase or not? |
There was a problem hiding this 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.
2a99901
to
33b2a40
Compare
Ok rebased |
@danielmarbach can you please submit this based on the |
Here we go #898 |
Proposed Changes
The worker service did mostly use
IModel
exception when the model was added with safely casted it toModelBase
but never actually verified if the model implementsModelBase
. Any model not deriving fromModelBase
would cause a NullRef. Given that theModelBase
method is only used in the exception case I moved the conversion toModelBase
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 applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe 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.
CONTRIBUTING.md
documentFurther Comments