Decouple wait_for_readiness from CLI parsing && fix minor typos#26
Open
S0nee wants to merge 2 commits intotempoxyz:mainfrom
Open
Decouple wait_for_readiness from CLI parsing && fix minor typos#26S0nee wants to merge 2 commits intotempoxyz:mainfrom
wait_for_readiness from CLI parsing && fix minor typos#26S0nee wants to merge 2 commits intotempoxyz:mainfrom
Conversation
Removed the direct CliArgs::parse() call from `wait_for_readiness` and instead passes `timeout` as a parameter from `main`. Previously, `wait_for_readiness` re-parsed CLI arguments internally to access the `timeout` value. This created tight coupling between the function and the CLI layer. Although this worked for the current binary use case, it introduced several architectural drawbacks: - The function depended directly on CLI parsing. - It could not be reused programmatically without CLI context. - CLI parsing was executed twice. `wait_for_readiness` is business logic and should not depend on how configuration is obtained. What Changed: - Added `timeout`: Duration parameter to `wait_for_readiness` - Removed internal `CliArgs::parse()` call - Passed `Duration::from_secs(args.timeout)` from `main` - Updated timeout error message to use `timeout.as_secs()`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the direct
CliArgs::parse()call fromwait_for_readinessand instead passestimeoutas a parameter frommain.Previously,
wait_for_readinessre-parsed CLI arguments internally to access thetimeoutvalue. This created tight coupling between the function and the CLI layer.Although this worked for the current binary use case, it has several architectural drawbacks:
wait_for_readinessis business logic and should not depend on how configuration is obtained.What Changed:
timeout: Duration parameter towait_for_readinessCliArgs::parse()callDuration::from_secs(args.timeout) frommaintimeouterror message to usetimeout.as_secs()Fixed syntactic errors:
transacion>transactioninmain.rsand in the rootREADME.Notes:
These changes are primarily architectural improvements and are not critical fixes.