-
Notifications
You must be signed in to change notification settings - Fork 876
fix(coderd): handle deletes and links for new agent/app audit resources #16670
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
if xerrors.Is(err, sql.ErrNoRows) { | ||
return true | ||
} | ||
api.Logger.Error(ctx, "unable to fetch workspace", slog.Error(err)) |
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.
Review: This code-path is confusing, I feel we should return an explicit boolean here, but I simply followed existing convention.
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 agree. Do we run a db query for every single audit log row? I was unaware this function existed tbh
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.
Yeah, sure looks like we call it as part of convertAuditLog
😰. I'm surprised the API response isn't slower TBH.
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 created an issue: #16718
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.
This follows our existing patterns. I agree both this functions feel a bit off, and feel inefficient too.
Do we really do these functions for every audit log row?!
if xerrors.Is(err, sql.ErrNoRows) { | ||
return true | ||
} | ||
api.Logger.Error(ctx, "unable to fetch workspace", slog.Error(err)) |
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 agree. Do we run a db query for every single audit log row? I was unaware this function existed tbh
Yeah, I was pretty surprised as well. I'm going to merge this but let's create a follow-up issue to track improvements to this code-path. |
These code-paths were overlooked in #16493.