-
Notifications
You must be signed in to change notification settings - Fork 696
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
[WIP] [Feature] add batch delete execution_phase api #6267
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -170,3 +170,11 @@ func NewExecutionRepo( | |||||||||||||||||||||||||||||||||
metrics: metrics, | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
func (r *ExecutionRepo) Delete(ctx context.Context, executionPhase string) error { | ||||||||||||||||||||||||||||||||||
result := r.db.Delete(&models.Execution{}, "phase = ?", executionPhase) | ||||||||||||||||||||||||||||||||||
if result.Error != nil { | ||||||||||||||||||||||||||||||||||
return result.Error | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
return nil | ||||||||||||||||||||||||||||||||||
Comment on lines
+175
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding validation for execution phase
Consider adding validation to ensure Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #50b8fe Should Bito avoid suggestions like this for future reviews? (Manage Rules)
|
||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,3 +152,17 @@ func (m *AdminService) TerminateExecution( | |
m.Metrics.executionEndpointMetrics.terminate.Success() | ||
return response, nil | ||
} | ||
|
||
func (m *AdminService) DeleteExecutionPhase( | ||
ctx context.Context, request *admin.ExecutionPhaseDeleteRequest) (*admin.ExecutionPhaseDeleteResponse, error) { | ||
var response *admin.ExecutionPhaseDeleteResponse | ||
var err error | ||
m.Metrics.executionEndpointMetrics.terminate.Time(func() { | ||
response, err = m.ExecutionManager.DeleteExecutionPhase(ctx, request) | ||
Comment on lines
+160
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using specific metric for DeleteExecutionPhase
Consider using a more specific metric name for Code suggestionCheck the AI-generated fix before applying
Code Review Run #50b8fe Should Bito avoid suggestions like this for future reviews? (Manage Rules)
|
||
}) | ||
if err != nil { | ||
return nil, util.TransformAndRecordError(err, &m.Metrics.executionEndpointMetrics.terminate) | ||
} | ||
m.Metrics.executionEndpointMetrics.terminate.Success() | ||
return response, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Consider adding error wrapping with context when returning the database error. This would help with debugging by providing more context about what operation failed. Maybe something like:
fmt.Errorf("failed to delete execution phase %s: %w", executionPhase, err)
Code suggestion
Code Review Run #50b8fe
Should Bito avoid suggestions like this for future reviews? (Manage Rules)