fix(lightpush): no response on err (#1083)

This commit is contained in:
richΛrd 2024-04-15 08:56:03 -04:00 committed by GitHub
parent 0260cfe954
commit 714a310462
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -73,7 +73,9 @@ func (serv *LightpushService) postMessagev1(w http.ResponseWriter, req *http.Req
if err != nil { if err != nil {
w.WriteHeader(http.StatusServiceUnavailable) w.WriteHeader(http.StatusServiceUnavailable)
_, err = w.Write([]byte(err.Error())) _, err = w.Write([]byte(err.Error()))
if err != nil {
serv.log.Error("writing response", zap.Error(err)) serv.log.Error("writing response", zap.Error(err))
}
} else { } else {
writeErrOrResponse(w, err, true) writeErrOrResponse(w, err, true)
} }

View File

@ -151,7 +151,6 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
wakuLP.metrics.RecordError(messagePushFailure) wakuLP.metrics.RecordError(messagePushFailure)
responseMsg := fmt.Sprintf("Could not publish message: %s", err.Error()) responseMsg := fmt.Sprintf("Could not publish message: %s", err.Error())
responsePushRPC.Response.Info = &responseMsg responsePushRPC.Response.Info = &responseMsg
return
} else { } else {
responsePushRPC.Response.IsSuccess = true responsePushRPC.Response.IsSuccess = true
responseMsg := "OK" responseMsg := "OK"