Skip to content

Commit

Permalink
Merge pull request #772 from fopina/fopina-busy-order
Browse files Browse the repository at this point in the history
busyhandler execution sorting
  • Loading branch information
Victor Castell committed May 29, 2020
2 parents bf60359 + 4622b76 commit bc22773
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dkron/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"sort"

"github.com/gin-contrib/expvar"
"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -351,5 +352,9 @@ func (h *HTTPTransport) busyHandler(c *gin.Context) {
executions = append(executions, NewExecutionFromProto(e))
}

sort.SliceStable(executions, func(i, j int) bool {
return executions[i].StartedAt.Before(executions[j].StartedAt)
})

renderJSON(c, http.StatusOK, executions)
}

0 comments on commit bc22773

Please sign in to comment.