From 379042d91a2cc51e9b2dcbe0fde6545c0515d607 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 26 Sep 2024 22:41:15 -0500 Subject: [PATCH] Removed some unnecessary null checks --- src/Foundatio.AWS/Queues/SQSQueue.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Foundatio.AWS/Queues/SQSQueue.cs b/src/Foundatio.AWS/Queues/SQSQueue.cs index 390fc36..59c27f4 100644 --- a/src/Foundatio.AWS/Queues/SQSQueue.cs +++ b/src/Foundatio.AWS/Queues/SQSQueue.cs @@ -103,20 +103,20 @@ protected override async Task EnqueueImplAsync(T data, QueueEntryOptions if (!String.IsNullOrEmpty(options.UniqueId)) message.MessageDeduplicationId = options.UniqueId; - if (!String.IsNullOrEmpty(options?.CorrelationId)) + if (!String.IsNullOrEmpty(options.CorrelationId)) message.MessageAttributes.Add("CorrelationId", new MessageAttributeValue { DataType = "String", StringValue = options.CorrelationId }); - if (options?.Properties != null) + if (options.Properties is not null) { foreach (var property in options.Properties) message.MessageAttributes.Add(property.Key, new MessageAttributeValue { DataType = "String", - StringValue = property.Value.ToString() // TODO: Support more than string data types + StringValue = property.Value // TODO: Support more than string data types }); } @@ -127,7 +127,7 @@ protected override async Task EnqueueImplAsync(T data, QueueEntryOptions _logger.LogTrace("Enqueued SQS message {MessageId}", response.MessageId); Interlocked.Increment(ref _enqueuedCount); - var entry = new QueueEntry(response.MessageId, options?.CorrelationId, data, this, _timeProvider.GetUtcNow().UtcDateTime, 0); + var entry = new QueueEntry(response.MessageId, options.CorrelationId, data, this, _timeProvider.GetUtcNow().UtcDateTime, 0); await OnEnqueuedAsync(entry).AnyContext(); return response.MessageId;