-
Notifications
You must be signed in to change notification settings - Fork 88
CLOUDP-113344: Improve time of new version checker #1010
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add in the description of the PR the strategy that you have used to improve the timing of this feature? Thanks! : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking and trying to improve on the timing here, I left some comments on code organization.
I have a couple of recommendations based on what looks to be around abstractions, either premature or leaky.
File saving could be improved, either by relaying on viper, or by making the code less abstract.
I don't think a "printer" abstraction should have access to the file system, this seems to be a leaky abstraction, if the responsability of the interface is to "print" (based on name) it should jsut do that, consider ways to simplify printer and favour composition so that the dependency on the file system can be removed.
Finally lumping brew configs and latest release meta info in the same abstraction may not be the right call, consider if they can be split and just like with printer and the file system think of ways to favour composition over nested dependencies, these problems becomes somewhat evident by looking at this line:
func NewPrinterWithFinder(ctx context.Context, f VersionFinder) Printer {
return &printer{c: ctx, finder: f, store: NewStore(afero.NewOsFs())}
}
your printer has a direct dependency on "Store" (whatever that may mean) which in turn has a direct dependency on afero, and encapsulating this chain of dependencies is one of the reasons reviewing this PR takes a while as it takes a bit of scrolling around to follow the dependencies and interactions
My machine (not M1):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there
internal/homebrew/loadersaver.go
Outdated
ExecutablePath string `yaml:"path"` | ||
HomePath string `yaml:"home_path"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] I'm not sure I understand why we store these paths, wouldn't storing isHomebrew: <true|false>
be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, storing a boolean is enough, will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the pair programming we ended up leaving both for usage, LMK if you want to still have boolean only stored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I would wait for Gustavo to review this PR as he paired with you. Thanks for all your work on this one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM comments are not blcoking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restamp
Proposed changes
Jira ticket: CLOUDP-113344
/Users/<user>/.config/mongocli/rstate.yaml
and update it every 24 hours./Users/<user>/.config/mongocli/brew.yaml
and update it every 24 hours.Checklist
make fmt
and formatted my codeHelp me testing this on a non-M1 machine:
Further comments
Before:
After (M1)
1st run