From f948c8db500b9623fbad1a15f4452dc35b966202 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 8 Apr 2020 00:18:05 +0800 Subject: [PATCH] Fixed kafka consumer group does not works bug. #541 --- src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs index e4de064..3af3d95 100644 --- a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs +++ b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs @@ -14,7 +14,7 @@ namespace DotNetCore.CAP.Kafka { internal sealed class KafkaConsumerClient : IConsumerClient { - private readonly SemaphoreSlim _connectionLock = new SemaphoreSlim(initialCount: 1, maxCount: 1); + private static readonly SemaphoreSlim ConnectionLock = new SemaphoreSlim(initialCount: 1, maxCount: 1); private readonly string _groupId; private readonly KafkaOptions _kafkaOptions; @@ -100,7 +100,7 @@ namespace DotNetCore.CAP.Kafka return; } - _connectionLock.Wait(); + ConnectionLock.Wait(); try { @@ -117,7 +117,7 @@ namespace DotNetCore.CAP.Kafka } finally { - _connectionLock.Release(); + ConnectionLock.Release(); } }