Skip to content

Commit

Permalink
Removed some unnecessary null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Sep 27, 2024
1 parent fef35ae commit 379042d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Foundatio.AWS/Queues/SQSQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ protected override async Task<string> 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
});
}

Expand All @@ -127,7 +127,7 @@ protected override async Task<string> EnqueueImplAsync(T data, QueueEntryOptions
_logger.LogTrace("Enqueued SQS message {MessageId}", response.MessageId);

Interlocked.Increment(ref _enqueuedCount);
var entry = new QueueEntry<T>(response.MessageId, options?.CorrelationId, data, this, _timeProvider.GetUtcNow().UtcDateTime, 0);
var entry = new QueueEntry<T>(response.MessageId, options.CorrelationId, data, this, _timeProvider.GetUtcNow().UtcDateTime, 0);
await OnEnqueuedAsync(entry).AnyContext();

return response.MessageId;
Expand Down

0 comments on commit 379042d

Please sign in to comment.