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 incorrect .orElse usage. #3957

Merged

Conversation

ivanpedersen
Copy link
Contributor

Since the parameter of .orElse() is still evaluated we end up calling the registry even if the schema is found in the cache.

Using .orElseGet() instead fixes this issue.

See: https://www.baeldung.com/java-optional-or-else-vs-or-else-get

Fixes: #3956

Since the parameter of .orElse() is still evaluated we end up calling
the registry even if the schema is found in the cache.

Using .orElseGet() instead fixes this issue.

See: https://www.baeldung.com/java-optional-or-else-vs-or-else-get
@apicurio-bot
Copy link

apicurio-bot bot commented Nov 8, 2023

Thank you for creating a pull request!

Pinging @EricWittmann to respond or triage.

@EricWittmann
Copy link
Member

Nice fix, thanks!

@EricWittmann EricWittmann merged commit 28fb49d into Apicurio:main Nov 9, 2023
20 checks passed
@Sabmit
Copy link

Sabmit commented Oct 2, 2024

Hello,

Thank you for this finding @ivanpedersen.
I was wondering why this is not included in 2.6.4.Final and only available in v3?

@gmouss
Copy link

gmouss commented Nov 8, 2024

Hey,
@EricWittmann Can this fix be backported to earlier versions ?
Thank you

@gmouss
Copy link

gmouss commented Nov 12, 2024

Hello,
@EricWittmann Maybe I wasn't being clear. I meant: can you backport this fix to earlier versions ?
We're currently running on 2.4.3.Final version, and we're not ready to upgrade to a new major version (3+). But we can manage to upgrade to minor versions.
We want to avoid maintaining custom fixes.
Thank you

@carlesarnal carlesarnal added this to the 2.6.x milestone Nov 25, 2024
@carlesarnal carlesarnal added the backport-2.x Backport fix to Registry v2 label Nov 25, 2024
@carlesarnal
Copy link
Member

Done in #5638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-2.x Backport fix to Registry v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema registry is called even when local cache exists.
5 participants