Skip to content

Commit

Permalink
Remove invalid timeout path from AsyncWaitStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoanet committed Jan 20, 2024
1 parent dcc8602 commit 6bf90cf
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Disruptor/AsyncWaitStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,21 @@ public async ValueTask<SequenceWaitResult> WaitForAsync(long sequence, Dependent
{
while (dependentSequences.CursorValue < sequence)
{
var waitSucceeded = await WaitForAsyncImpl(sequence, dependentSequences, cancellationToken).ConfigureAwait(false);
if (!waitSucceeded)
{
return SequenceWaitResult.Timeout;
}
await WaitForAsyncImpl(sequence, dependentSequences, cancellationToken).ConfigureAwait(false);
}

return dependentSequences.AggressiveSpinWaitFor(sequence, cancellationToken);
}

private async ValueTask<bool> WaitForAsyncImpl(long sequence, DependentSequenceGroup dependentSequences, CancellationToken cancellationToken)
private async ValueTask WaitForAsyncImpl(long sequence, DependentSequenceGroup dependentSequences, CancellationToken cancellationToken)
{
TaskCompletionSource<bool> tcs;

lock (_gate)
{
if (dependentSequences.CursorValue >= sequence)
{
return true;
return;
}

cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -89,7 +85,5 @@ private async ValueTask<bool> WaitForAsyncImpl(long sequence, DependentSequenceG
// the sequencer barrier after cancellation.

await tcs.Task.ConfigureAwait(false);

return tcs.Task.IsCompleted;
}
}

0 comments on commit 6bf90cf

Please sign in to comment.