-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[KS-590] Auto-approval for workflow spec deletion #15414
Conversation
I see you updated files related to
|
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
64d4820
to
5774807
Compare
@@ -510,6 +510,21 @@ func (s *service) DeleteJob(ctx context.Context, args *DeleteJobArgs) (int64, er | |||
logger.Errorw("Failed to push metrics for job proposal deletion", "err", err) | |||
} | |||
|
|||
job, err := s.jobORM.FindJobByExternalJobID(ctx, proposal.ExternalJobID.UUID) | |||
if err != nil { |
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.
if err != nil { | |
if !errors.Is(err, sql.ErrNoRows) { |
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.
oh yeah just copy the blob that @giogam linked :D including the proposal.ExternalJobID.Valid check since that would return false when the job is not in approved status.
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.
Why should we treat the NoRows error in a special way? Why not just catch any error?
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.
Typically it is the ORM
's responsibility to hide the sql details by catching this error internally and returning nil
instead.
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 guess the only issue here is that the ORM isn't returning nil here. List will return empty arrays when no record is found but get will typically return no row errors.
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.
hmm I'm confused - is my code going to work or not? If there's any error, I give up and don't delete. That should be fine if nothing is found. What else can go wrong?
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.
Oh I see it just logs it and doesn't return, and with the .valid check before that, it looks like it should be fine now
5774807
to
fed1eb9
Compare
fed1eb9
to
4f9e258
Compare
No description provided.