wilfred-s commented on a change in pull request #125: [YUNIKORN-79] Internal
metrics are unavailable through REST API
URL:
https://github.com/apache/incubator-yunikorn-core/pull/125#discussion_r404468939
##########
File path: pkg/webservice/handlers.go
##########
@@ -245,7 +245,7 @@ func GetApplicationHistory(w http.ResponseWriter, r
*http.Request) {
records := imHistory.GetRecords()
for _, record := range records {
if record == nil {
- break
+ continue
Review comment:
The break is correct, it pushes you out of the for loop. Which means you are
done collecting records.
The issue is in the return of the function. Leverage the "least indent flow"
and early returns to code:
```
if imHistory == nil {
http.Error(w, "Internal metrics collection is not enabled.",
http.StatusInternalServerError)
return
}
var result []*dao....
records := ....
....
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services