-
Notifications
You must be signed in to change notification settings - Fork 10
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
minor refactor for pubsub #75
Conversation
Minor refactor for pubsub regarding the message validator and trying to make the code more idiomatic.
src/pubsub/momento.rs
Outdated
error!("pubsub: invalid message received"); | ||
RESPONSE_EX.increment(); | ||
PUBSUB_RECEIVE_INVALID.increment(); | ||
continue; | ||
} | ||
MessageValidationResult::Corrupted => { | ||
Err(ValidationError::Corrupted) => { |
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.
Curious why one of these cases increments RESPONSE_EX and the other PUBSUB_RECEIVE, but both have a message suggesting they are pubsub messages.
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.
This might be up for debate. Initially my thought was that invalid messages (perhaps produced by some non-rpc-perf process) should be ignored with just an invalid counter incremented.
src/pubsub/kafka.rs
Outdated
Some(Ok(message)) => match validator.validate(&mut message.to_owned()) { | ||
Err(ValidationError::Unexpected) => { | ||
error!("pubsub: invalid message received"); | ||
RESPONSE_EX.increment(); |
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.
Is it worth moving the counter stuff into the validation function and having a much simpler match case for both consumers?
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.
Great idea. Moved into the validator.
Minor refactor for pubsub regarding the message validator and trying to make the code more idiomatic.