mirror of https://github.com/miniflux/v2.git
Display memory usage and some metrics in logs
This commit is contained in:
parent
4cdb2f820b
commit
45dde0cf4a
|
@ -8,10 +8,9 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/miniflux/miniflux/logger"
|
|
||||||
|
|
||||||
"github.com/miniflux/miniflux/config"
|
"github.com/miniflux/miniflux/config"
|
||||||
"github.com/miniflux/miniflux/daemon"
|
"github.com/miniflux/miniflux/daemon"
|
||||||
|
"github.com/miniflux/miniflux/logger"
|
||||||
"github.com/miniflux/miniflux/storage"
|
"github.com/miniflux/miniflux/storage"
|
||||||
"github.com/miniflux/miniflux/version"
|
"github.com/miniflux/miniflux/version"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -27,6 +28,16 @@ func Run(cfg *config.Config, store *storage.Storage) {
|
||||||
signal.Notify(stop, os.Interrupt)
|
signal.Notify(stop, os.Interrupt)
|
||||||
signal.Notify(stop, syscall.SIGTERM)
|
signal.Notify(stop, syscall.SIGTERM)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
var m runtime.MemStats
|
||||||
|
runtime.ReadMemStats(&m)
|
||||||
|
logger.Debug("Alloc=%vK, TotalAlloc=%vK, Sys=%vK, NumGC=%v, GoRoutines=%d, NumCPU=%d",
|
||||||
|
m.Alloc/1024, m.TotalAlloc/1024, m.Sys/1024, m.NumGC, runtime.NumGoroutine(), runtime.NumCPU())
|
||||||
|
time.Sleep(30 * time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
translator := locale.Load()
|
translator := locale.Load()
|
||||||
feedHandler := feed.NewFeedHandler(store, translator)
|
feedHandler := feed.NewFeedHandler(store, translator)
|
||||||
pool := scheduler.NewWorkerPool(feedHandler, cfg.WorkerPoolSize())
|
pool := scheduler.NewWorkerPool(feedHandler, cfg.WorkerPoolSize())
|
||||||
|
|
Loading…
Reference in New Issue