chore: lightpush - error metric less variable by only setting a fixed string (#3020)

This commit is contained in:
Ivan FB 2024-09-10 17:30:09 +02:00 committed by GitHub
parent 5a0edff79a
commit d3e6717a60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 13 deletions

View File

@ -88,11 +88,9 @@ suite "Waku Lightpush - End To End":
# Then the message is not relayed but not due to RLN
assert publishResponse.isErr(), "We expect an error response"
assert (
publishResponse.error.contains(
"Lightpush request has not been published to any peers"
)
), "incorrect error response"
assert (publishResponse.error == protocol_metrics.notPublishedAnyPeer),
"incorrect error response"
suite "Waku LightPush Validation Tests":
asyncTest "Validate message size exceeds limit":
@ -181,8 +179,5 @@ suite "RLN Proofs as a Lightpush Service":
# Then the message is not relayed but not due to RLN
assert publishResponse.isErr(), "We expect an error response"
assert (
publishResponse.error.contains(
"Lightpush request has not been published to any peers"
)
), "incorrect error response"
assert (publishResponse.error == protocol_metrics.notPublishedAnyPeer),
"incorrect error response"

View File

@ -5,6 +5,7 @@ import
../waku_relay,
./common,
./protocol,
./protocol_metrics,
../waku_rln_relay,
../waku_rln_relay/protocol_types
@ -54,8 +55,6 @@ proc getRelayPushHandler*(
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
notice "Lightpush request has not been published to any peers", msg_hash = msgHash
return err(
"Lightpush request has not been published to any peers. msg_hash: " & msgHash
)
return err(protocol_metrics.notPublishedAnyPeer)
return ok()

View File

@ -16,3 +16,4 @@ const
emptyResponseBodyFailure* = "empty_response_body_failure"
messagePushFailure* = "message_push_failure"
requestLimitReachedFailure* = "request_limit_reached_failure"
notPublishedAnyPeer* = "not_published_to_any_peer"