mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
Split out notifiers
- splits out notifiers and writes status for async handler Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
fca32a0e79
commit
f7cf7a6496
@ -17,12 +17,15 @@ import (
|
||||
// MakeQueuedProxy accepts work onto a queue
|
||||
func MakeQueuedProxy(metrics metrics.MetricOptions, wildcard bool, canQueueRequests queue.CanQueueRequests, pathTransformer URLPathTransformer) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
if r.Body != nil {
|
||||
defer r.Body.Close()
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
@ -37,6 +40,7 @@ func MakeQueuedProxy(metrics metrics.MetricOptions, wildcard bool, canQueueReque
|
||||
urlVal, urlErr := url.Parse(callbackURLHeader)
|
||||
if urlErr != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
w.Write([]byte(urlErr.Error()))
|
||||
return
|
||||
}
|
||||
@ -55,9 +59,7 @@ func MakeQueuedProxy(metrics metrics.MetricOptions, wildcard bool, canQueueReque
|
||||
CallbackURL: callbackURL,
|
||||
}
|
||||
|
||||
err = canQueueRequests.Queue(req)
|
||||
|
||||
if err != nil {
|
||||
if err = canQueueRequests.Queue(req); err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(err.Error()))
|
||||
fmt.Println(err)
|
||||
|
Reference in New Issue
Block a user