From 714a310462accacad90c47638a16ae2873ec97b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?rich=CE=9Brd?= Date: Mon, 15 Apr 2024 08:56:03 -0400 Subject: [PATCH] fix(lightpush): no response on err (#1083) --- 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 488b0b16..87b3729d 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 7bf2c7e7..fafc27f5 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"