Skip to content

Commit 431b837

Browse files
levdimovmhowlett
authored andcommitted
Correct task awaiting with ConfigureAwait(false) in Producer. (#967)
* PersistenceStatus not set correctly (#806) * use IConsumer/IProducer (#878) * add native methods from alpine-librdkafka.so (#883) * correct task awaiting with ConfigureAwait(false). also added ConfigureAwaitChecker.Analyzer package so you will have warnings in future * revert unnecessary whitespace changes * removed dependency
1 parent c9a2d91 commit 431b837

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Confluent.Kafka/Producer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ public async Task<DeliveryResult<TKey, TValue>> ProduceAsync(
627627
{
628628
keyBytes = (keySerializer != null)
629629
? keySerializer.Serialize(message.Key, new SerializationContext(MessageComponentType.Key, topicPartition.Topic))
630-
: await asyncKeySerializer.SerializeAsync(message.Key, new SerializationContext(MessageComponentType.Key, topicPartition.Topic));
630+
: await asyncKeySerializer.SerializeAsync(message.Key, new SerializationContext(MessageComponentType.Key, topicPartition.Topic)).ConfigureAwait(false);
631631
}
632632
catch (Exception ex)
633633
{
@@ -646,7 +646,7 @@ public async Task<DeliveryResult<TKey, TValue>> ProduceAsync(
646646
{
647647
valBytes = (valueSerializer != null)
648648
? valueSerializer.Serialize(message.Value, new SerializationContext(MessageComponentType.Value, topicPartition.Topic))
649-
: await asyncValueSerializer.SerializeAsync(message.Value, new SerializationContext(MessageComponentType.Value, topicPartition.Topic));
649+
: await asyncValueSerializer.SerializeAsync(message.Value, new SerializationContext(MessageComponentType.Value, topicPartition.Topic)).ConfigureAwait(false);
650650
}
651651
catch (Exception ex)
652652
{
@@ -676,7 +676,7 @@ public async Task<DeliveryResult<TKey, TValue>> ProduceAsync(
676676
message.Timestamp, topicPartition.Partition, message.Headers,
677677
handler);
678678

679-
return await handler.Task;
679+
return await handler.Task.ConfigureAwait(false);
680680
}
681681
else
682682
{

0 commit comments

Comments
 (0)