From ef28c19b8237e03bd521118b04109e9922c9d51d Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 7 Mar 2017 00:25:13 -0800 Subject: adding catch for ErrRecursivePush log and ignoring null values --- system/api/push.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/api/push.go b/system/api/push.go index b7c5642..a6402bc 100644 --- a/system/api/push.go +++ b/system/api/push.go @@ -7,6 +7,7 @@ import ( "github.com/ponzu-cms/ponzu/system/item" "github.com/tidwall/gjson" + "golang.org/x/net/http2" ) func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, data []byte) { @@ -23,8 +24,12 @@ func push(res http.ResponseWriter, req *http.Request, pt func() interface{}, dat for i := range values { val := values[i] val.ForEach(func(k, v gjson.Result) bool { + if v.String() == "null" { + return true + } + err := pusher.Push(v.String(), nil) - if err != nil { + if err != nil && err != http2.ErrRecursivePush { log.Println("Error during Push of value:", v.String()) } -- cgit v1.2.3