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

metadata: memoize the parsed build versions #22113

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Jan 31, 2025

Description

There will only be a small set of consul build versions that a single consul server will witness. Inside of metadata.IsConsulServer we use a very expensive function in the hashicorp/go-version library to parse these into read-only *version.Version structs all over Consul.

Memoize these in a package cache map. Likely the thing will only have like 2 keys in it ever over the life of the process.

@rboyer rboyer self-assigned this Jan 31, 2025
@rboyer rboyer requested a review from a team as a code owner January 31, 2025 22:15
@dhiaayachi dhiaayachi added the backport/all Apply backports for all active releases per .release/versions.hcl label Jan 31, 2025
Copy link
Collaborator

@dhiaayachi dhiaayachi left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/all Apply backports for all active releases per .release/versions.hcl pr/no-metrics-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants