Enable profiler
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
|||||||
netHttp "net/http"
|
netHttp "net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
_ "net/http/pprof" // Register pprof
|
||||||
|
|
||||||
"github.com/debridmediamanager/zurg/internal/config"
|
"github.com/debridmediamanager/zurg/internal/config"
|
||||||
"github.com/debridmediamanager/zurg/internal/router"
|
"github.com/debridmediamanager/zurg/internal/router"
|
||||||
"github.com/debridmediamanager/zurg/internal/torrent"
|
"github.com/debridmediamanager/zurg/internal/torrent"
|
||||||
@@ -16,7 +18,6 @@ import (
|
|||||||
"github.com/dgraph-io/ristretto"
|
"github.com/dgraph-io/ristretto"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
"github.com/panjf2000/ants/v2"
|
"github.com/panjf2000/ants/v2"
|
||||||
// _ "net/http/pprof" // Register pprof
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func MainApp(configPath string) {
|
func MainApp(configPath string) {
|
||||||
@@ -64,12 +65,12 @@ func MainApp(configPath string) {
|
|||||||
handler.RedirectFixedPath = true
|
handler.RedirectFixedPath = true
|
||||||
router.ApplyRouteTable(handler, getfile, torrentMgr, config, rd, log.Named("router"))
|
router.ApplyRouteTable(handler, getfile, torrentMgr, config, rd, log.Named("router"))
|
||||||
|
|
||||||
// go func() {
|
go func() {
|
||||||
// if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {
|
if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {
|
||||||
// zurglog.Errorf("Failed to start pprof: %v", err)
|
zurglog.Errorf("Failed to start pprof: %v", err)
|
||||||
// os.Exit(1)
|
os.Exit(1)
|
||||||
// }
|
}
|
||||||
// }()
|
}()
|
||||||
|
|
||||||
addr := fmt.Sprintf("%s:%s", config.GetHost(), config.GetPort())
|
addr := fmt.Sprintf("%s:%s", config.GetHost(), config.GetPort())
|
||||||
zurglog.Infof("Starting server on %s", addr)
|
zurglog.Infof("Starting server on %s", addr)
|
||||||
|
|||||||
Reference in New Issue
Block a user