mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-08 04:05:20 +00:00
Sort the ps output
Provide consistent ordering for the ps command - longest duration listed first
This commit is contained in:
parent
9929751cc8
commit
642cee1342
@ -1224,6 +1224,11 @@ func (s *Server) ProcessHandler(c *gin.Context) {
|
|||||||
models = append(models, mr)
|
models = append(models, mr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slices.SortStableFunc(models, func(i, j api.ProcessModelResponse) int {
|
||||||
|
// longest duration remaining listed first
|
||||||
|
return cmp.Compare(j.ExpiresAt.Unix(), i.ExpiresAt.Unix())
|
||||||
|
})
|
||||||
|
|
||||||
c.JSON(http.StatusOK, api.ProcessResponse{Models: models})
|
c.JSON(http.StatusOK, api.ProcessResponse{Models: models})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user