fix: retry send tasks stuck in Entry state

This commit is contained in:
Ivan FB 2026-06-23 11:39:35 +02:00 committed by GitHub
parent 1a3b3204fa
commit 5309ce294b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 1 deletions

View File

@ -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

View File

@ -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: