Skip to content

Commit

Permalink
More collection literals
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Jun 6, 2024
1 parent bc1172e commit 2ed5a08
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken)
finally
{
// Wait until the tasks complete or the stop token triggers
var tasks = receiverTasks.Concat(new[] { Task.Delay(Timeout.Infinite, cancellationToken), });
var tasks = receiverTasks.Concat([Task.Delay(Timeout.Infinite, cancellationToken)]);
await Task.WhenAny(tasks).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken)
// get the producer and send the event accordingly
var producer = await GetProducerAsync(reg: registration, deadletter: false, cancellationToken: cancellationToken).ConfigureAwait(false);
Logger.SendingEvent(eventBusId: @event.Id, eventHubName: producer.EventHubName, scheduled: scheduled);
await producer.SendAsync(new[] { data }, cancellationToken).ConfigureAwait(false);
await producer.SendAsync([data], cancellationToken).ConfigureAwait(false);

// return the sequence number
return scheduled != null ? new ScheduledResult(id: data.SequenceNumber, scheduled: scheduled.Value) : null;
Expand Down Expand Up @@ -415,7 +415,7 @@ private async Task OnEventReceivedAsync(EventRegistration reg, EventConsumerRegi
{
// get the producer for the dead letter event hub and send the event there
var dlqProcessor = await GetProducerAsync(reg: reg, deadletter: true, cancellationToken: cancellationToken).ConfigureAwait(false);
await dlqProcessor.SendAsync(new[] { data }, cancellationToken).ConfigureAwait(false);
await dlqProcessor.SendAsync([data], cancellationToken).ConfigureAwait(false);
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken)
finally
{
// Wait until the tasks complete or the stop token triggers
var tasks = receiverTasks.Concat(new[] { Task.Delay(Timeout.Infinite, cancellationToken), });
var tasks = receiverTasks.Concat([Task.Delay(Timeout.Infinite, cancellationToken)]);
await Task.WhenAny(tasks).ConfigureAwait(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tingle.EventBus.Transports.Kafka/KafkaTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken)
finally
{
// Wait until the tasks complete or the stop token triggers
var tasks = receiverTasks.Concat(new[] { Task.Delay(Timeout.Infinite, cancellationToken), });
var tasks = receiverTasks.Concat([Task.Delay(Timeout.Infinite, cancellationToken)]);
await Task.WhenAny(tasks).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract partial class AbstractEventSerializer : IEventSerializer
private const string TrimPattern = "(Serializer|EventSerializer)$";

///
protected static readonly IList<string> JsonContentTypes = new[] { "application/json", "text/json", };
protected static readonly IList<string> JsonContentTypes = ["application/json", "text/json"];

private static readonly Regex trimPattern = GetTrimPattern();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class XmlEventSerializer(IOptionsMonitor<EventBusSerializationOptions> op
: AbstractEventSerializer(optionsAccessor, loggerFactory)
{
/// <inheritdoc/>
protected override IList<string> SupportedMediaTypes => new[] { "application/xml", "text/xml", };
protected override IList<string> SupportedMediaTypes => ["application/xml", "text/xml"];

/// <inheritdoc/>
protected override Task<IEventEnvelope<T>?> DeserializeToEnvelopeAsync<T>(Stream stream,
Expand Down

0 comments on commit 2ed5a08

Please sign in to comment.