Skip to content

Commit c33706b

Browse files
committed
formatting
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 900646d commit c33706b

File tree

6 files changed

+133
-133
lines changed

6 files changed

+133
-133
lines changed

RabbitMQ.Stream.Client/Client.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ await Request<DeletePublisherRequest, DeletePublisherResponse>(corr =>
354354
Dictionary<string, string> properties, Func<Deliver, Task> deliverHandler,
355355
Func<bool, Task<IOffsetType>> consumerUpdateHandler = null)
356356
{
357-
return await Subscribe(new RawConsumerConfig(stream) {OffsetSpec = offsetType},
357+
return await Subscribe(new RawConsumerConfig(stream) { OffsetSpec = offsetType },
358358
initialCredit,
359359
properties,
360360
deliverHandler,
@@ -713,7 +713,7 @@ public async Task<CloseResponse> Close(string reason)
713713
// if the client has entities (publishers or consumers) it will be released from the pool
714714
// Release will decrement the active ids for the connection
715715
// if the active ids are 0 the connection will be closed
716-
internal async Task<CloseResponse> MaybeClose(string reason,string stream, ConnectionsPool pool)
716+
internal async Task<CloseResponse> MaybeClose(string reason, string stream, ConnectionsPool pool)
717717
{
718718
if (!string.IsNullOrEmpty(ClientId))
719719
{
@@ -758,9 +758,9 @@ public async ValueTask<MetaDataResponse> QueryMetadata(string[] streams)
758758

759759
public async Task<bool> StreamExists(string stream)
760760
{
761-
var streams = new[] {stream};
761+
var streams = new[] { stream };
762762
var response = await QueryMetadata(streams).ConfigureAwait(false);
763-
return response.StreamInfos is {Count: >= 1} &&
763+
return response.StreamInfos is { Count: >= 1 } &&
764764
response.StreamInfos[stream].ResponseCode == ResponseCode.Ok;
765765
}
766766

@@ -807,7 +807,7 @@ public static ManualResetValueTaskSource<T> Rent()
807807
}
808808
else
809809
{
810-
return new ManualResetValueTaskSource<T>() {RunContinuationsAsynchronously = true};
810+
return new ManualResetValueTaskSource<T>() { RunContinuationsAsynchronously = true };
811811
}
812812
}
813813

RabbitMQ.Stream.Client/ConnectionsPool.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ public void Remove(string clientId)
232232
public int ConnectionsCount => Connections.Count;
233233

234234
public int ActiveIdsCount => Connections.Values.Sum(x => x.StreamIds.Values.Sum(y => y.Count));
235-
235+
236236
public int ActiveIdsCountForStream(string stream) => Connections.Values.Sum(x => x.StreamIds.TryGetValue(stream, out var streamIds) ? streamIds.Count : 0);
237-
237+
238238
public int ActiveIdsCountForClient(string clientId) => Connections.TryGetValue(clientId, out var connectionItem) ? connectionItem.StreamIds.Values.Sum(y => y.Count) : 0;
239-
239+
240240
public int ActiveIdsCountForClientAndStream(string clientId, string stream) => Connections.TryGetValue(clientId, out var connectionItem) && connectionItem.StreamIds.TryGetValue(stream, out var streamIds) ? streamIds.Count : 0;
241241
}

RabbitMQ.Stream.Client/RawConsumer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ internal void Validate()
8787

8888
switch (ConsumerFilter)
8989
{
90-
case {PostFilter: null}:
90+
case { PostFilter: null }:
9191
throw new ArgumentException("PostFilter must be provided when Filter is set");
92-
case {Values.Count: 0}:
92+
case { Values.Count: 0 }:
9393
throw new ArgumentException("Values must be provided when Filter is set");
9494
}
9595
}
9696

97-
internal bool IsFiltering => ConsumerFilter is {Values.Count: > 0};
97+
internal bool IsFiltering => ConsumerFilter is { Values.Count: > 0 };
9898

9999
// it is needed to be able to add the subscriptions arguments
100100
// see consumerProperties["super-stream"] = SuperStream;

RabbitMQ.Stream.Client/RawProducer.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public RawProducerConfig(string stream)
4242

4343
internal void Validate()
4444
{
45-
if (Filter is {FilterValue: not null} && !AvailableFeaturesSingleton.Instance.PublishFilter)
45+
if (Filter is { FilterValue: not null } && !AvailableFeaturesSingleton.Instance.PublishFilter)
4646
{
4747
throw new UnsupportedOperationException(Consts.FilterNotSupported);
4848
}
@@ -128,7 +128,9 @@ private async Task Init()
128128
{
129129
_config.ConfirmHandler(new Confirmation
130130
{
131-
PublishingId = id, Code = ResponseCode.Ok, Stream = _config.Stream
131+
PublishingId = id,
132+
Code = ResponseCode.Ok,
133+
Stream = _config.Stream
132134
});
133135
}
134136
catch (Exception e)
@@ -148,7 +150,7 @@ private async Task Init()
148150
{
149151
foreach (var (id, code) in errors)
150152
{
151-
_config.ConfirmHandler(new Confirmation {PublishingId = id, Code = code,});
153+
_config.ConfirmHandler(new Confirmation { PublishingId = id, Code = code, });
152154
}
153155

154156
_semaphore.Release(errors.Length);
@@ -164,7 +166,7 @@ private async Task Init()
164166
throw new CreateProducerException($"producer could not be created code: {response.ResponseCode}");
165167
}
166168

167-
private bool IsFilteringEnabled => _config.Filter is {FilterValue: not null};
169+
private bool IsFilteringEnabled => _config.Filter is { FilterValue: not null };
168170

169171
/// <summary>
170172
/// SubEntry Batch send: Aggregate more messages under the same publishingId.
@@ -362,7 +364,7 @@ public async Task<ResponseCode> Close()
362364
_logger.LogError(e, "Error removing the producer id: {PublisherId} from the server", _publisherId);
363365
}
364366

365-
var closed = await _client.MaybeClose($"client-close-publisher: {_publisherId}",
367+
var closed = await _client.MaybeClose($"client-close-publisher: {_publisherId}",
366368
_config.Stream, _config.Pool)
367369
.ConfigureAwait(false);
368370
ClientExceptions.MaybeThrowException(closed.ResponseCode, $"client-close-publisher: {_publisherId}");

RabbitMQ.Stream.Client/RoutingClient.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ internal static async Task<IClient> LookupConnection(
6767
// In this case we just return the node (leader for producer, random for consumer)
6868
// since there is not load balancer configuration
6969

70-
return await routing.CreateClient(clientParameters with {Endpoint = endPointNoLb}, broker, logger)
70+
return await routing.CreateClient(clientParameters with { Endpoint = endPointNoLb }, broker, logger)
7171
.ConfigureAwait(false);
7272
}
7373

7474
// here it means that there is a AddressResolver configuration
7575
// so there is a load-balancer or proxy we need to get the right connection
7676
// as first we try with the first node given from the LB
7777
var endPoint = clientParameters.AddressResolver.EndPoint;
78-
var client = await routing.CreateClient(clientParameters with {Endpoint = endPoint}, broker, logger)
78+
var client = await routing.CreateClient(clientParameters with { Endpoint = endPoint }, broker, logger)
7979
.ConfigureAwait(false);
8080

8181
var advertisedHost = GetPropertyValue(client.ConnectionProperties, "advertised_host");
@@ -87,7 +87,7 @@ internal static async Task<IClient> LookupConnection(
8787
attemptNo++;
8888
await client.Close("advertised_host or advertised_port doesn't match").ConfigureAwait(false);
8989

90-
client = await routing.CreateClient(clientParameters with {Endpoint = endPoint}, broker, logger)
90+
client = await routing.CreateClient(clientParameters with { Endpoint = endPoint }, broker, logger)
9191
.ConfigureAwait(false);
9292

9393
advertisedHost = GetPropertyValue(client.ConnectionProperties, "advertised_host");
@@ -156,7 +156,7 @@ private static string GetPropertyValue(IDictionary<string, string> connectionPro
156156
public static async Task<IClient> LookupLeaderConnection(ClientParameters clientParameters,
157157
StreamInfo metaDataInfo, ConnectionsPool pool, ILogger logger = null)
158158
{
159-
return await pool.GetOrCreateClient(metaDataInfo.Leader.ToString(),metaDataInfo.Stream,
159+
return await pool.GetOrCreateClient(metaDataInfo.Leader.ToString(), metaDataInfo.Stream,
160160
async () =>
161161
await LookupConnection(clientParameters, metaDataInfo.Leader, MaxAttempts(metaDataInfo), logger)
162162
.ConfigureAwait(false)).ConfigureAwait(false);
@@ -168,7 +168,7 @@ await LookupConnection(clientParameters, metaDataInfo.Leader, MaxAttempts(metaDa
168168
public static async Task<IClient> LookupRandomConnection(ClientParameters clientParameters,
169169
StreamInfo metaDataInfo, ConnectionsPool pool, ILogger logger = null)
170170
{
171-
var brokers = new List<Broker>() {metaDataInfo.Leader};
171+
var brokers = new List<Broker>() { metaDataInfo.Leader };
172172
brokers.AddRange(metaDataInfo.Replicas);
173173
brokers.Sort((_, _) => Random.Shared.Next(-1, 1));
174174
var exceptions = new List<Exception>();

0 commit comments

Comments
 (0)