From 547f6f2869485814164c1a602268c3b58ac03699 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 9 Apr 2024 09:59:12 -0400 Subject: [PATCH] fix(lightpush): no response on err --- cmd/waku/server/rest/lightpush_rest.go | 4 +++- waku/v2/protocol/lightpush/waku_lightpush.go | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/waku/server/rest/lightpush_rest.go b/cmd/waku/server/rest/lightpush_rest.go index 488b0b166..87b3729d5 100644 --- a/cmd/waku/server/rest/lightpush_rest.go +++ b/cmd/waku/server/rest/lightpush_rest.go @@ -73,7 +73,9 @@ func (serv *LightpushService) postMessagev1(w http.ResponseWriter, req *http.Req if err != nil { w.WriteHeader(http.StatusServiceUnavailable) _, err = w.Write([]byte(err.Error())) - serv.log.Error("writing response", zap.Error(err)) + if err != nil { + serv.log.Error("writing response", zap.Error(err)) + } } else { writeErrOrResponse(w, err, true) } diff --git a/waku/v2/protocol/lightpush/waku_lightpush.go b/waku/v2/protocol/lightpush/waku_lightpush.go index 7bf2c7e71..fafc27f58 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush.go +++ b/waku/v2/protocol/lightpush/waku_lightpush.go @@ -151,7 +151,6 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream) wakuLP.metrics.RecordError(messagePushFailure) responseMsg := fmt.Sprintf("Could not publish message: %s", err.Error()) responsePushRPC.Response.Info = &responseMsg - return } else { responsePushRPC.Response.IsSuccess = true responseMsg := "OK"