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

Prevent warnings variable @metadata not initialised #86

Conversation

etiennechabert
Copy link
Contributor

Issue #, if available:
#84

Description of changes:
Instead of directly using @metadata, use the metadata method in charge of doing an initialization when necessary

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@etiennechabert etiennechabert requested a review from a team as a code owner February 28, 2023 11:30
Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for contributing.

Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

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

Actually it seems like this change caused tests to fail: https://github.com/aws/aws-xray-sdk-ruby/actions/runs/4292482419/jobs/7484285744#step:4:51

Could you try reproducing the test failure locally and seeing how we could fix this?

@etiennechabert
Copy link
Contributor Author

etiennechabert commented Mar 3, 2023

@willarmiros should have paid more attention to what metadata method is doing...
not a regular memorization pattern there, actually two actions are being made:

  • Initialize @metadata when necessary
  • Initialize a sub_meta for a given namespace inside @metadata
  • In the end returns a SubMeta object instead of a Metadata object, just a bit weird given the method name if I may.

Anyway, just adding a defined? to the condition is preventing the warning, without changing the behavior, working fine on my side when tested locally.

@willarmiros can you give me a new run on the tests 🙏 ?

Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

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

Thanks for the change!

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.

2 participants