service: Fix tag deserialization for large messages#552
Merged
Conversation
Tags are i32 varints, but we were only deserializing the first byte. Simplify some related details: - Decoding a varint returns the updated position, so we don't need to use encoder._TagSize() - We can directly construct a memory view once instead of constructing a BytesIO for each loop iteration.
pbirkhol-ni
approved these changes
Dec 12, 2023
Contributor
pbirkhol-ni
left a comment
There was a problem hiding this comment.
I wasn't very familiar with this code so I took some time to familiarize myself. What you did seems reasonable.
Contributor
dixonjoel
approved these changes
Dec 13, 2023
bkeryan
added a commit
that referenced
this pull request
Dec 13, 2023
* tests: Add test cases for big messages (100 fields) * service: Fix tag deserialization for large messages Tags are i32 varints, but we were only deserializing the first byte. Simplify some related details: - Decoding a varint returns the updated position, so we don't need to use encoder._TagSize() - We can directly construct a memory view once instead of constructing a BytesIO for each loop iteration. * tests: Use pytest.approx instead of choosing exactly comparable floats
1 task
bkeryan
added a commit
that referenced
this pull request
Dec 13, 2023
) service: Fix tag deserialization for large messages (#552) * tests: Add test cases for big messages (100 fields) * service: Fix tag deserialization for large messages Tags are i32 varints, but we were only deserializing the first byte. Simplify some related details: - Decoding a varint returns the updated position, so we don't need to use encoder._TagSize() - We can directly construct a memory view once instead of constructing a BytesIO for each loop iteration. * tests: Use pytest.approx instead of choosing exactly comparable floats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
Tags are i32 varints, but we were only deserializing the first byte.
Simplify some related details:
Why should this Pull Request be merged?
Fixes AB#2602618: Protobuf Error on Measurement run [MeasurementLink UI Editor/InstrumentStudio]
What testing has been done?
Ran
poetry run pytest -v.Manually tested the service attached to the bug report with my
users/bkeryan/fix-field-id-1.2branch (targetingreleases/1.2).