Skip to content

Commit 008d3d4

Browse files
committed
Remove debug endpoint from ml
1 parent c3fd240 commit 008d3d4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

experiment/ml/analyze/http.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ import (
3535
)
3636

3737
func serveOnPort(ctx context.Context, storageClient *storage.Client, predictor *predictionClient, port int, timeout time.Duration) error {
38+
mux := http.NewServeMux()
3839

39-
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
40+
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
4041
ctx, cancel := context.WithTimeout(ctx, timeout)
4142
defer cancel()
4243
status, body, err := processRequest(ctx, storageClient, predictor, r)
@@ -53,12 +54,12 @@ func serveOnPort(ctx context.Context, storageClient *storage.Client, predictor *
5354
}
5455
})
5556

56-
http.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) {
57+
mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) {
5758
w.WriteHeader(http.StatusOK)
5859
})
5960

6061
log.Println("Listening for connections on port", port)
61-
return http.ListenAndServe(":"+strconv.Itoa(port), nil)
62+
return http.ListenAndServe(":"+strconv.Itoa(port), mux)
6263
}
6364

6465
func processRequest(ctx context.Context, storageClient *storage.Client, predictor *predictionClient, r *http.Request) (int, string, error) {

0 commit comments

Comments
 (0)