You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bl...@apache.org on 2023/03/16 08:17:27 UTC
[pulsar-dotpulsar] branch master updated: refactor(producer): Use the producers Topic member in GetNumberOfPartitions instead of passing it in as an argument (#144)
This is an automated email from the ASF dual-hosted git repository.
blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 65bee00 refactor(producer): Use the producers Topic member in GetNumberOfPartitions instead of passing it in as an argument (#144)
65bee00 is described below
commit 65bee00748b50b58b134dbb5d38c6e91109de301
Author: Thomas O'Neill <to...@gmail.com>
AuthorDate: Thu Mar 16 04:17:21 2023 -0400
refactor(producer): Use the producers Topic member in GetNumberOfPartitions instead of passing it in as an argument (#144)
Co-authored-by: Thomas O'Neill <to...@new-innov.com>
---
src/DotPulsar/Internal/Producer.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/DotPulsar/Internal/Producer.cs b/src/DotPulsar/Internal/Producer.cs
index f8e8568..e699d42 100644
--- a/src/DotPulsar/Internal/Producer.cs
+++ b/src/DotPulsar/Internal/Producer.cs
@@ -111,7 +111,7 @@ public sealed class Producer<TMessage> : IProducer<TMessage>, IRegisterEvent
private async Task Monitor()
{
- var numberOfPartitions = await GetNumberOfPartitions(Topic, _cts.Token).ConfigureAwait(false);
+ var numberOfPartitions = await GetNumberOfPartitions(_cts.Token).ConfigureAwait(false);
var isPartitionedTopic = numberOfPartitions != 0;
var monitoringTasks = new Task<ProducerState>[isPartitionedTopic ? numberOfPartitions : 1];
@@ -183,10 +183,10 @@ public sealed class Producer<TMessage> : IProducer<TMessage>, IRegisterEvent
return producer;
}
- private async Task<uint> GetNumberOfPartitions(string topic, CancellationToken cancellationToken)
+ private async Task<uint> GetNumberOfPartitions(CancellationToken cancellationToken)
{
- var connection = await _connectionPool.FindConnectionForTopic(topic, cancellationToken).ConfigureAwait(false);
- var commandPartitionedMetadata = new PulsarApi.CommandPartitionedTopicMetadata { Topic = topic };
+ var connection = await _connectionPool.FindConnectionForTopic(Topic, cancellationToken).ConfigureAwait(false);
+ var commandPartitionedMetadata = new PulsarApi.CommandPartitionedTopicMetadata { Topic = Topic };
var response = await connection.Send(commandPartitionedMetadata, cancellationToken).ConfigureAwait(false);
response.Expect(PulsarApi.BaseCommand.Type.PartitionedMetadataResponse);