Fatally exit on http server error

main
Cameron Murphy Reikes 2 years ago
parent 20b7465780
commit 2fc9527a17

@ -363,7 +363,7 @@ func completion(w http.ResponseWriter, req *http.Request) {
} }
resp, err := c.CreateCompletion(ctx, req) resp, err := c.CreateCompletion(ctx, req)
if err != nil { if err != nil {
log.Println("Error Failed to generate: ", err) log.Println("Error Failed to generate, failed to create completion: ", err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
@ -490,6 +490,6 @@ func main() {
portString := ":8090" portString := ":8090"
log.Println("DO NOT RUN WITH CLOUDFLARE PROXY it rate limits based on IP, if behind proxy every IP will be the same. Would need to fix req.RemoteAddr. Serving on " + portString + "...") log.Println("DO NOT RUN WITH CLOUDFLARE PROXY it rate limits based on IP, if behind proxy every IP will be the same. Would need to fix req.RemoteAddr. Serving on " + portString + "...")
http.ListenAndServe(portString, nil) log.Fatal(http.ListenAndServe(portString, nil))
} }

Loading…
Cancel
Save