Skip to content

Commit 5bce3c3

Browse files
committed
Revert back to await from continue with
Remove extension for continueWith Update test to ignore maxbuffer tests until we return functionality
1 parent 0f03ea0 commit 5bce3c3

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

src/kafka-net/Common/Extensions.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,5 @@ public static Exception ExtractException(this Task task)
234234

235235
return new ApplicationException("Unknown exception occured.");
236236
}
237-
238-
/// <summary>
239-
/// Extracts a concrete exception out of a Continue with result.
240-
/// </summary>
241-
public static void ThrowOnFault(this Task task)
242-
{
243-
if (task.IsFaulted == false) return;
244-
if (task.Exception != null)
245-
throw task.Exception.Flatten();
246-
247-
throw new ApplicationException("Unknown exception occured.");
248-
}
249-
250237
}
251238
}

src/kafka-net/Producer.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public Producer(IBrokerRouter brokerRouter, int maximumAsyncRequests = MaximumAs
108108
/// <param name="timeout">Interal kafka timeout to wait for the requested level of ack to occur before returning. Defaults to 1000ms.</param>
109109
/// <param name="codec">The codec to apply to the message collection. Defaults to none.</param>
110110
/// <returns>List of ProduceResponses from each partition sent to or empty list if acks = 0.</returns>
111-
public Task<List<ProduceResponse>> SendMessageAsync(string topic, IEnumerable<Message> messages, Int16 acks = 1,
111+
public async Task<List<ProduceResponse>> SendMessageAsync(string topic, IEnumerable<Message> messages, Int16 acks = 1,
112112
TimeSpan? timeout = null, MessageCodec codec = MessageCodec.CodecNone)
113113
{
114114
if (_stopToken.IsCancellationRequested)
@@ -126,15 +126,11 @@ public Task<List<ProduceResponse>> SendMessageAsync(string topic, IEnumerable<Me
126126

127127
_asyncCollection.AddRange(batch);
128128

129-
return Task.WhenAll(batch.Select(x => x.Tcs.Task))
130-
.ContinueWith(t =>
131-
{
132-
t.ThrowOnFault();
129+
await Task.WhenAll(batch.Select(x => x.Tcs.Task));
133130

134-
return batch.Select(topicMessage => topicMessage.Tcs.Task.Result)
131+
return batch.Select(topicMessage => topicMessage.Tcs.Task.Result)
135132
.Distinct()
136133
.ToList();
137-
});
138134
}
139135

140136
/// <summary>

src/kafka-tests/Unit/ProducerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ public void ProducerShouldBlockWhenFullBufferReached()
298298
}
299299

300300
[Test]
301+
[Ignore("Removed the max message limit. Caused performance problems. Will find a better way.")]
301302
public void ProducerShouldBlockEvenOnMessagesInTransit()
302303
{
303304
//with max buffer set below the batch size, this should cause the producer to block until batch delay time.

0 commit comments

Comments
 (0)