Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Wolverine/Runtime/Handlers/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public async Task<IContinuation> ExecuteAsync(MessageContext context, Cancellati

_tracker.ExecutionFinished(envelope);

return new MessageSucceededContinuation(_tracker);
return MessageSucceededContinuation.Instance;
}
catch (Exception e)
{
Expand Down
16 changes: 15 additions & 1 deletion src/Wolverine/Runtime/MessageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,21 @@ private bool hasRequestedReply()

private bool isMissingRequestedReply()
{
return Outstanding.Concat(_sent ?? []).All(x => x.MessageType != Envelope!.ReplyRequested);
var replyRequested = Envelope!.ReplyRequested;
foreach (var envelope in Outstanding)
{
if (envelope.MessageType == replyRequested) return false;
}

if (_sent != null)
{
foreach (var envelope in _sent)
{
if (envelope.MessageType == replyRequested) return false;
}
}

return true;
}

/// <summary>
Expand Down
9 changes: 1 addition & 8 deletions src/Wolverine/Runtime/MessageSucceededContinuation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ public class MessageSucceededContinuation : IContinuation
{
public static readonly MessageSucceededContinuation Instance = new();

private IMessageTracker? _tracker;

private MessageSucceededContinuation()
{
}

public MessageSucceededContinuation(IMessageTracker tracker)
{
_tracker = tracker;
}

public async ValueTask ExecuteAsync(IEnvelopeLifecycle lifecycle,
IWolverineRuntime runtime,
DateTimeOffset now, Activity? activity)
Expand All @@ -30,7 +23,7 @@ public async ValueTask ExecuteAsync(IEnvelopeLifecycle lifecycle,

await lifecycle.CompleteAsync();

(_tracker ?? runtime.MessageTracking).MessageSucceeded(lifecycle.Envelope!);
runtime.MessageTracking.MessageSucceeded(lifecycle.Envelope!);
}
catch (Exception ex)
{
Expand Down
Loading