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

fix: get a diff only when in debug #55

Merged
merged 5 commits into from
Mar 30, 2023
Merged

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Mar 29, 2023

When running with debug=false calculating diffs make no sense given that they are not going to be printed. This was causing a lot of time being spent here for no reason

ref: cosmos/cosmos-sdk#15594

@facundomedica facundomedica requested a review from a team as a code owner March 29, 2023 14:47
proto/merge.go Outdated
@@ -100,7 +100,7 @@ func mergedFileDescriptors(debug bool) (*descriptorpb.FileDescriptorSet, error)
// If there's a mismatch, we log a warning. If there was no
// mismatch, then we do nothing, and take the protoregistry file
// descriptor as the correct one.
if !protov2.Equal(protodesc.ToFileDescriptorProto(protoregFd), fd) {
if !protov2.Equal(protodesc.ToFileDescriptorProto(protoregFd), fd) && debug {
Copy link
Member

@julienrbrt julienrbrt Mar 30, 2023

Choose a reason for hiding this comment

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

Oh, I understand now what you meant on Slack. The diff isn't printed anyway, because it is printed only on debug... So even before that we did not have a way to easily call debug from the SDK.

Maybe in a follow-up we should add an option in proto.MergedRegistry() to call DebugFileDescriptorsMismatch instead of MergedFileDescriptors? This way we can handle the display of the debug directly in the SDK.

@julienrbrt
Copy link
Member

Needs a changelog as well.

@julienrbrt julienrbrt changed the title fix: get a diff only when not in debug fix: get a diff only when in debug Mar 30, 2023
@julienrbrt julienrbrt enabled auto-merge (squash) March 30, 2023 08:09
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

This makes sense @facundomedica, sorry for missing that in my original PR. Thanks!

proto/merge.go Outdated Show resolved Hide resolved
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
@julienrbrt julienrbrt enabled auto-merge (squash) March 30, 2023 08:25
@julienrbrt julienrbrt merged commit b12c8ca into main Mar 30, 2023
@julienrbrt julienrbrt deleted the facu/fix-nondebug-time branch March 30, 2023 08:31
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