mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-26 11:29:28 +00:00
fix: retry send tasks stuck in Entry state
This commit is contained in:
parent
1a3b3204fa
commit
5309ce294b
@ -32,5 +32,10 @@ method process*(
|
||||
currentProcessor = currentProcessor.fallbackProcessor
|
||||
keepTrying = task.state == DeliveryState.FallbackRetry
|
||||
|
||||
if task.state == DeliveryState.FallbackRetry:
|
||||
# A task still in `FallbackRetry` exhausted the chain without delivering, and
|
||||
# one still in `Entry` was never attempted because no processor had a usable
|
||||
# peer yet (e.g. a lightpush peer that finishes registering right after the
|
||||
# first send). Both must be queued for the next round so the service loop
|
||||
# retries them; otherwise the task would sit untouched until it ages out.
|
||||
if task.state == DeliveryState.FallbackRetry or task.state == DeliveryState.Entry:
|
||||
task.state = DeliveryState.NextRoundRetry
|
||||
|
||||
@ -352,6 +352,43 @@ suite "Waku API - Send":
|
||||
(await node.stop()).isOkOr:
|
||||
raiseAssert "Failed to stop node: " & error
|
||||
|
||||
asyncTest "Edge sender delivers via lightpush (no relay)":
|
||||
## Reproduces issue #3847: an Edge node (no relay mounted) that is only
|
||||
## connected to a lightpush-capable peer must deliver through lightpush.
|
||||
var node: Waku
|
||||
lockNewGlobalBrokerContext:
|
||||
node = (await createNode(createApiNodeConf(cli_args.WakuMode.Edge))).valueOr:
|
||||
raiseAssert error
|
||||
node.mountMessagingClient().isOkOr:
|
||||
raiseAssert "Failed to mount messaging: " & error
|
||||
(await node.start()).isOkOr:
|
||||
raiseAssert "Failed to start Waku node: " & error
|
||||
|
||||
# Edge node has no relay; its only path to the network is the
|
||||
# lightpush peer it is connected to.
|
||||
await node.node.connectToNodes(@[lightpushNodePeerInfo])
|
||||
|
||||
check node.node.wakuRelay.isNil()
|
||||
|
||||
let eventManager = newSendEventListenerManager(node.brokerCtx)
|
||||
defer:
|
||||
await eventManager.teardown()
|
||||
|
||||
let envelope = MessageEnvelope.init(
|
||||
ContentTopic("/waku/2/default-content/proto"), "test payload"
|
||||
)
|
||||
|
||||
let requestId = (await node.send(envelope)).valueOr:
|
||||
raiseAssert error
|
||||
|
||||
const eventTimeout = 10.seconds
|
||||
discard await eventManager.waitForEvents(eventTimeout)
|
||||
|
||||
eventManager.validate({SendEventOutcome.Propagated}, requestId)
|
||||
|
||||
(await node.stop()).isOkOr:
|
||||
raiseAssert "Failed to stop node: " & error
|
||||
|
||||
asyncTest "Send fully validates fallback to lightpush":
|
||||
var node: LogosDelivery
|
||||
lockNewGlobalBrokerContext:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user