From 3d400a4087eea36dec920f844564057656f335aa Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Wed, 1 May 2024 01:28:40 +0200 Subject: [PATCH] d --- waku/waku_lightpush/protocol.nim | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/waku/waku_lightpush/protocol.nim b/waku/waku_lightpush/protocol.nim index 16be3beb50..74ac288447 100644 --- a/waku/waku_lightpush/protocol.nim +++ b/waku/waku_lightpush/protocol.nim @@ -38,13 +38,15 @@ proc handleRequest*( if reqDecodeRes.isErr(): pushResponseInfo = decodeRpcFailure & ": " & $reqDecodeRes.error + # error "bad lightpush request", error = $reqDecodeRes.error elif reqDecodeRes.get().request.isNone(): pushResponseInfo = emptyRequestBodyFailure + # error "lightpush request is none" elif wl.requestRateLimiter.isSome() and not wl.requestRateLimiter.get().tryConsume(1): isRejectedDueRateLimit = true let pushRpcRequest = reqDecodeRes.get() - debug "lightpush request rejected due rate limit exceeded", - peerId = peerId, requestId = pushRpcRequest.requestId + # debug "lightpush request rejected due rate limit exceeded", + # peerid = peerId, requestId = pushRpcRequest.requestId pushResponseInfo = TooManyRequestsMessage waku_service_requests_rejected.inc(labelValues = ["Lightpush"]) else: @@ -60,14 +62,25 @@ proc handleRequest*( pubSubTopic = request.get().pubSubTopic message = request.get().message waku_lightpush_messages.inc(labelValues = ["PushRequest"]) - debug "push request", - peerId = peerId, - requestId = requestId, - pubsubTopic = pubsubTopic, - hash = pubsubTopic.computeMessageHash(message).to0xHex() + + # let msgHash = pubsubTopic.computeMessageHash(message).to0xHex() + + # debug "lightpush request", + # peerId = peerId, + # requestId = requestId, + # pubsubTopic = pubsubTopic, + # msg_hash = msgHash let handleRes = await wl.pushHandler(peerId, pubsubTopic, message) isSuccess = handleRes.isOk() + + # if isSuccess: + # debug "lightpush request processed correctly", + # lightpush_client_peer_id = shortLog(peerId), + # requestId = requestId, + # pubsubTopic = pubsubTopic, + # msg_hash = msgHash + pushResponseInfo = (if isSuccess: "OK" else: handleRes.error) if not isSuccess and not isRejectedDueRateLimit: