Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Wolverine/Envelope.Internals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,24 @@ internal async ValueTask QuickSendAsync()

_enqueued = true;

if (Sender.Latched) return;
if (Sender.Latched)
{
// If the sender is latched, it indicates that the endpoint is currently unavailable
// (e.g., due to a network disconnection or a failure in the transport).
// In such cases, we should *not* attempt to send the message immediately.
//
// Instead, if the sender is a SendingAgent, we explicitly mark the envelope as failed
// so that it will be retried later when the connection is re-established.
//
// This conditional block ensures that latched agents skip enqueuing the message,
// but still track the failure to maintain durability and retry logic.
if (Sender is SendingAgent sendingAgent)
{
await sendingAgent.MarkProcessingFailureAsync(this, null);
}

return;
}

if (Sender.Endpoint?.TelemetryEnabled ?? false)
{
Expand Down
Loading