Skip to content

Reduce the number of times we read tedge.toml #3471

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

Open
jarhodes314 opened this issue Mar 14, 2025 · 0 comments
Open

Reduce the number of times we read tedge.toml #3471

jarhodes314 opened this issue Mar 14, 2025 · 0 comments
Labels
refactoring Developer value

Comments

@jarhodes314
Copy link
Contributor

Is your refactoring request related to a problem? Please describe.
I'm currently in the middle of making tedge config async, and this has led me to discover that we are frequently loading configuration for every component of a process (e.g. in tedge-agent, we load the config globally, then for operations, then for restart management, etc.). I believe this is due to us needing the config_dir as well as tedge_config, so we just pass in tedge_config_location and then (rather wastefully) re-read the config.

Describe the solution you'd like
TEdgeConfig could keep track of where it originated from by cloning TEdgeConfigLocation. Then when we need to access fields of TEdgeConfigLocation, we could do this via TEdgeConfig, avoiding both duplicated reads and unnecessary parameters for the functions currently performing duplicated reads.

Describe alternatives you've considered
We could just pass in the configuration directory separately to the relevant functions, however I think it makes sense to have a single source of truth.

Additional context

@jarhodes314 jarhodes314 added the refactoring Developer value label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Developer value
Projects
None yet
Development

No branches or pull requests

1 participant