misc: adds option to enable pprof

This commit is contained in:
stefanodvx 2025-04-16 13:03:05 +02:00
parent 285d7eb4aa
commit fb702b40f5
3 changed files with 16 additions and 1 deletions

12
main.go
View file

@ -1,10 +1,16 @@
package main
import (
"fmt"
"govd/bot"
"govd/database"
"govd/util"
"log"
"net/http"
"os"
"strconv"
_ "net/http/pprof"
"github.com/joho/godotenv"
)
@ -14,6 +20,12 @@ func main() {
if err != nil {
log.Fatal("error loading .env file")
}
profilerPort, err := strconv.Atoi(os.Getenv("PROFILER_PORT"))
if err == nil && profilerPort > 0 {
go func() {
http.ListenAndServe(fmt.Sprintf("localhost:%d", profilerPort), nil)
}()
}
util.CleanupDownloadsDir()
util.StartDownloadsCleanup()
ok := util.CheckFFmpeg()