From cd070957bdedf9cccc32ff618cfdcb4f93ff5d95 Mon Sep 17 00:00:00 2001 From: PJ Date: Wed, 4 Jan 2017 22:41:43 +1100 Subject: [PATCH] Run Recovery middleware's error handler in a goroutine -Addresses: https://github.com/urfave/negroni/issues/147#issuecomment-249397722 --- recovery.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recovery.go b/recovery.go index 8396cb1..a4946f0 100644 --- a/recovery.go +++ b/recovery.go @@ -48,7 +48,7 @@ func (rec *Recovery) ServeHTTP(rw http.ResponseWriter, r *http.Request, next htt } if rec.ErrorHandlerFunc != nil { - func() { + go func() { defer func() { if err := recover(); err != nil { rec.Logger.Printf("provided ErrorHandlerFunc panic'd: %s, trace:\n%s", err, debug.Stack())