Skip to content

Commit a7dbf77

Browse files
authored
refactor: use the built-in max/min to simplify the code (#2571)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> use the built-in max/min to simplify the code Inspired by #2488 and replace all. Signed-off-by: yinwenyu6 <[email protected]>
1 parent 82970e8 commit a7dbf77

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

pkg/rpc/server/da_visualization.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,7 @@ func (s *DAVisualizationServer) handleDAHealth(w http.ResponseWriter, r *http.Re
321321
)
322322

323323
// Look at recent submissions (last 10 or all if less)
324-
recentCount := 10
325-
if len(s.submissions) < recentCount {
326-
recentCount = len(s.submissions)
327-
}
324+
recentCount := min(len(s.submissions), 10)
328325

329326
// Analyze recent submissions
330327
for i := len(s.submissions) - recentCount; i < len(s.submissions); i++ {

0 commit comments

Comments
 (0)