mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +00:00
fix:lightppush v3 not returning relayed peers count (#3329)
* Fixing lightpush publish logs stated it was legacy lightpush, also fix on wrong mounted protocol check. * Fix lightpush v3 success report did not embed relayed peer count * Fix test that missed the case of non returning relayed peers
This commit is contained in:
parent
bf735e7779
commit
a3584caf5e
@ -224,6 +224,7 @@ suite "Waku Lightpush message delivery":
|
|||||||
## When
|
## When
|
||||||
let res = await lightNode.lightpushPublish(some(DefaultPubsubTopic), message)
|
let res = await lightNode.lightpushPublish(some(DefaultPubsubTopic), message)
|
||||||
assert res.isOk(), $res.error
|
assert res.isOk(), $res.error
|
||||||
|
assert res.get() == 1, "Expected to relay the message to 1 node"
|
||||||
|
|
||||||
## Then
|
## Then
|
||||||
check await completionFutRelay.withTimeout(5.seconds)
|
check await completionFutRelay.withTimeout(5.seconds)
|
||||||
|
|||||||
@ -1146,7 +1146,7 @@ proc lightpushPublishHandler(
|
|||||||
): Future[lightpush_protocol.WakuLightPushResult] {.async.} =
|
): Future[lightpush_protocol.WakuLightPushResult] {.async.} =
|
||||||
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
|
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
|
||||||
if not node.wakuLightpushClient.isNil():
|
if not node.wakuLightpushClient.isNil():
|
||||||
notice "publishing message with legacy lightpush",
|
notice "publishing message with lightpush",
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = message.contentTopic,
|
contentTopic = message.contentTopic,
|
||||||
target_peer_id = peer.peerId,
|
target_peer_id = peer.peerId,
|
||||||
@ -1154,7 +1154,7 @@ proc lightpushPublishHandler(
|
|||||||
return await node.wakuLightpushClient.publish(some(pubsubTopic), message, peer)
|
return await node.wakuLightpushClient.publish(some(pubsubTopic), message, peer)
|
||||||
|
|
||||||
if not node.wakuLightPush.isNil():
|
if not node.wakuLightPush.isNil():
|
||||||
notice "publishing message with self hosted legacy lightpush",
|
notice "publishing message with self hosted lightpush",
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
contentTopic = message.contentTopic,
|
contentTopic = message.contentTopic,
|
||||||
target_peer_id = peer.peerId,
|
target_peer_id = peer.peerId,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ const NoPeerNoneFoundError =
|
|||||||
RestApiResponse.serviceUnavailable("No suitable service peer & none discovered")
|
RestApiResponse.serviceUnavailable("No suitable service peer & none discovered")
|
||||||
|
|
||||||
proc useSelfHostedLightPush(node: WakuNode): bool =
|
proc useSelfHostedLightPush(node: WakuNode): bool =
|
||||||
return node.wakuLegacyLightPush != nil and node.wakuLegacyLightPushClient == nil
|
return node.wakuLightPush != nil and node.wakuLightPushClient == nil
|
||||||
|
|
||||||
proc convertErrorKindToHttpStatus(statusCode: LightpushStatusCode): HttpCode =
|
proc convertErrorKindToHttpStatus(statusCode: LightpushStatusCode): HttpCode =
|
||||||
## Lightpush status codes are matching HTTP status codes by design
|
## Lightpush status codes are matching HTTP status codes by design
|
||||||
|
|||||||
@ -98,6 +98,11 @@ proc handleRequest*(
|
|||||||
none[string]()
|
none[string]()
|
||||||
else:
|
else:
|
||||||
handleRes.error.desc,
|
handleRes.error.desc,
|
||||||
|
relayPeerCount:
|
||||||
|
if isSuccess:
|
||||||
|
some(handleRes.get())
|
||||||
|
else:
|
||||||
|
none[uint32](),
|
||||||
)
|
)
|
||||||
|
|
||||||
if not isSuccess:
|
if not isSuccess:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user