mirror of
https://github.com/axllent/mailpit.git
synced 2025-05-13 22:06:31 +02:00
Snapshot memory usage first
This commit is contained in:
parent
cea9518b4b
commit
4ebbdab7c0
@ -26,6 +26,11 @@ func AppInfo(w http.ResponseWriter, r *http.Request) {
|
||||
info := appVersion{}
|
||||
info.Version = config.Version
|
||||
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
|
||||
info.Memory = m.Sys - m.HeapReleased
|
||||
|
||||
latest, _, _, err := updater.GithubLatest(config.Repo, config.RepoBinaryName)
|
||||
if err == nil {
|
||||
info.LatestVersion = latest
|
||||
@ -40,11 +45,6 @@ func AppInfo(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
info.Messages = storage.CountTotal()
|
||||
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
|
||||
info.Memory = m.Sys - m.HeapReleased
|
||||
|
||||
bytes, _ := json.Marshal(info)
|
||||
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
|
Loading…
x
Reference in New Issue
Block a user