Remove profiler
This commit is contained in:
14
src/main.go
14
src/main.go
@@ -4,8 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
@@ -61,18 +59,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if v := os.Getenv("PROFILE"); len(v) > 0 {
|
|
||||||
port, err := strconv.ParseUint(v, 10, 16)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
go Profile(uint16(port))
|
|
||||||
|
|
||||||
log.Printf("Profiler is listening on :%d\n", port)
|
|
||||||
}
|
|
||||||
|
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
|
||||||
log.Printf("Listening on %s:%d\n", config.Host, config.Port+instanceID)
|
log.Printf("Listening on %s:%d\n", config.Host, config.Port+instanceID)
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"net/http/pprof"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Profile is a Goroutine for automatically profiling the program for optimization and debug reasons.
|
|
||||||
func Profile(port uint16) {
|
|
||||||
mux := http.NewServeMux()
|
|
||||||
mux.HandleFunc("/", pprof.Profile)
|
|
||||||
|
|
||||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), mux))
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user