-
Notifications
You must be signed in to change notification settings - Fork 214
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 performance for porter list #2096
Conversation
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Do not retrieve the full installatin definition for each installation returned from list. We only need that information for the show command. Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
if err != nil { | ||
return err | ||
} | ||
di := NewDisplayInstallation(installation) |
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.
I moved the conversion of installations to display installations so that we could test these functions. In other parts of Porter we do the same thing but I guess this function is old enough it was doing the conversion in the print function still.
pkg/porter/list.go
Outdated
if err != nil { | ||
return err | ||
return nil, errors.Wrap(err, "could not list installations") |
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.
Do we want to trace the error here?
pkg/porter/show.go
Outdated
return DisplayInstallation{}, err | ||
} | ||
|
||
func (p *Porter) NewDisplayInstallationWithSecrets(ctx context.Context, installation storage.Installation, run *storage.Run) (DisplayInstallation, error) { | ||
bun := cnab.ExtendedBundle{run.Bundle} |
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.
What if the run is nil here?
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.
Haha you caught that at the same time I did, I was fixing that right before our meeting this morning. I just pushed it up now.
It's possible for an installation record to be created but the bundle isn't run before porter show is called. I've fixed how we put together a DisplayInstallation to account for that. Otherwise that code is returning a nil pointer exception. Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@VinozzZ Okay I think I've fixed everything, please take another look! |
What does this change
Do not retrieve the full installation definition for each installation returned from list. We only need that information
for the show command. Right now porter is making multiple calls to both the storage and secrets plugin for each installation in the list results.
What issue does it fix
Closes #2040
Notes for the reviewer
Here is what the trace looks like with this fix (compared to the original trace which was huge)
Checklist
Reviewer Checklist