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

Optimises Bundle.MediaType() (#408 follow up) #409

Merged

Conversation

m1kola
Copy link
Member

@m1kola m1kola commented Sep 14, 2023

Description

It is a followup to #408 (comment)

Media type is an optional field and can be an empty string after looading. This change avoids unmarshalling every time we call MediaType() method by comparing to nil.

If value is nil - we need to load. If anything else (even an empty string) we already lazy-loaded the value.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2023
@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ca95325) 83.97% compared to head (4543bea) 83.97%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #409   +/-   ##
=======================================
  Coverage   83.97%   83.97%           
=======================================
  Files          27       27           
  Lines        1073     1073           
=======================================
  Hits          901      901           
  Misses        119      119           
  Partials       53       53           
Flag Coverage Δ
e2e 61.82% <ø> (ø)
unit 80.34% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
internal/catalogmetadata/types.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Media type is an optional field and can be an empty string after looading.
This change avoids unmarshalling every time we call MediaType() method
by comparing to `nil`.

If value is `nil` - we need to load. If anything else (even an empty string)
we already lazy-loaded the value.

Signed-off-by: Mikalai Radchuk <[email protected]>
@m1kola m1kola force-pushed the loadMediaType_optimisation branch from c8e1344 to 4543bea Compare September 14, 2023 09:42
@m1kola m1kola marked this pull request as ready for review September 14, 2023 09:42
@m1kola m1kola requested a review from a team as a code owner September 14, 2023 09:42
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2023
@joelanford joelanford added this pull request to the merge queue Sep 14, 2023
Merged via the queue into operator-framework:main with commit 21dbd8d Sep 14, 2023
12 checks passed
@m1kola m1kola deleted the loadMediaType_optimisation branch September 14, 2023 12:33
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