Implement proper checks for new torrents
This commit is contained in:
@@ -16,12 +16,16 @@ import (
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
|
||||
_ "net/http/pprof" // Register pprof
|
||||
)
|
||||
|
||||
func MainApp(configPath string) {
|
||||
log := logutil.NewLogger()
|
||||
zurglog := log.Named("zurg")
|
||||
|
||||
zurglog.Debugf("PID: %d", os.Getpid())
|
||||
|
||||
config, configErr := config.LoadZurgConfig(configPath, log.Named("config"))
|
||||
if configErr != nil {
|
||||
zurglog.Errorf("Config failed to load: %v", configErr)
|
||||
@@ -61,6 +65,13 @@ func MainApp(configPath string) {
|
||||
handler.RedirectFixedPath = true
|
||||
router.ApplyRouteTable(handler, getfile, torrentMgr, config, rd, log.Named("router"))
|
||||
|
||||
go func() {
|
||||
if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {
|
||||
zurglog.Errorf("Failed to start pprof: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
addr := fmt.Sprintf("%s:%s", config.GetHost(), config.GetPort())
|
||||
zurglog.Infof("Starting server on %s", addr)
|
||||
if err := netHttp.ListenAndServe(addr, handler); err != nil && err != netHttp.ErrServerClosed {
|
||||
|
||||
Reference in New Issue
Block a user