Commit 2f174536 authored by Marc Gravell's avatar Marc Gravell

expose await

parent ac64b29b
...@@ -396,7 +396,7 @@ async Task RunLoop() ...@@ -396,7 +396,7 @@ async Task RunLoop()
} }
} }
Assert.True(subChannel.IsCompleted); await subChannel.Completion;
await Assert.ThrowsAsync<ChannelClosedException>(async delegate await Assert.ThrowsAsync<ChannelClosedException>(async delegate
{ {
var final = await subChannel.ReadAsync().ForAwait(); var final = await subChannel.ReadAsync().ForAwait();
......
...@@ -81,6 +81,12 @@ internal ChannelMessageQueue(RedisChannel redisChannel, RedisSubscriber parent) ...@@ -81,6 +81,12 @@ internal ChannelMessageQueue(RedisChannel redisChannel, RedisSubscriber parent)
_queue.Reader.Completion.ContinueWith( _queue.Reader.Completion.ContinueWith(
(_, state) => ((ChannelMessageQueue)state).IsCompleted = true, this, TaskContinuationOptions.ExecuteSynchronously); (_, state) => ((ChannelMessageQueue)state).IsCompleted = true, this, TaskContinuationOptions.ExecuteSynchronously);
} }
/// <summary>
/// An awaitable task the indicates completion of the queue (including drain of data)
/// </summary>
public Task Completion => _queue.Reader.Completion;
private static readonly UnboundedChannelOptions s_ChannelOptions = new UnboundedChannelOptions private static readonly UnboundedChannelOptions s_ChannelOptions = new UnboundedChannelOptions
{ {
SingleWriter = true, SingleWriter = true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment