Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in SQSStorage.cs #8933

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/AWS/Orleans.Streaming.SQS/Storage/SQSStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class SQSStorage
/// <summary>
/// Maximum number of messages allowed by SQS to peak per request
/// </summary>
public const int MAX_NUMBER_OF_MESSAGE_TO_PEAK = 10;
public const int MAX_NUMBER_OF_MESSAGE_TO_PEEK = 10;
private const string AccessKeyPropertyName = "AccessKey";
private const string SecretKeyPropertyName = "SecretKey";
private const string ServicePropertyName = "Service";
Expand Down Expand Up @@ -53,28 +53,28 @@ public SQSStorage(ILoggerFactory loggerFactory, string queueName, string connect

private void ParseDataConnectionString(string dataConnectionString)
{
var parameters = dataConnectionString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var parameters = dataConnectionString.Split(';', StringSplitOptions.RemoveEmptyEntries);

var serviceConfig = parameters.Where(p => p.Contains(ServicePropertyName)).FirstOrDefault();
var serviceConfig = parameters.FirstOrDefault(p => p.Contains(ServicePropertyName));
if (!string.IsNullOrWhiteSpace(serviceConfig))
{
var value = serviceConfig.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
var value = serviceConfig.Split('=', StringSplitOptions.RemoveEmptyEntries);
if (value.Length == 2 && !string.IsNullOrWhiteSpace(value[1]))
service = value[1];
}

var secretKeyConfig = parameters.Where(p => p.Contains(SecretKeyPropertyName)).FirstOrDefault();
var secretKeyConfig = parameters.FirstOrDefault(p => p.Contains(SecretKeyPropertyName));
if (!string.IsNullOrWhiteSpace(secretKeyConfig))
{
var value = secretKeyConfig.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
var value = secretKeyConfig.Split('=', StringSplitOptions.RemoveEmptyEntries);
if (value.Length == 2 && !string.IsNullOrWhiteSpace(value[1]))
secretKey = value[1];
}

var accessKeyConfig = parameters.Where(p => p.Contains(AccessKeyPropertyName)).FirstOrDefault();
var accessKeyConfig = parameters.FirstOrDefault(p => p.Contains(AccessKeyPropertyName));
if (!string.IsNullOrWhiteSpace(accessKeyConfig))
{
var value = accessKeyConfig.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
var value = accessKeyConfig.Split('=', StringSplitOptions.RemoveEmptyEntries);
if (value.Length == 2 && !string.IsNullOrWhiteSpace(value[1]))
accessKey = value[1];
}
Expand Down Expand Up @@ -192,7 +192,7 @@ public async Task<IEnumerable<SQSMessage>> GetMessages(int count = 1)
if (count < 1)
throw new ArgumentOutOfRangeException(nameof(count));

var request = new ReceiveMessageRequest { QueueUrl = queueUrl, MaxNumberOfMessages = count <= MAX_NUMBER_OF_MESSAGE_TO_PEAK ? count : MAX_NUMBER_OF_MESSAGE_TO_PEAK };
var request = new ReceiveMessageRequest { QueueUrl = queueUrl, MaxNumberOfMessages = count <= MAX_NUMBER_OF_MESSAGE_TO_PEEK ? count : MAX_NUMBER_OF_MESSAGE_TO_PEEK };
var response = await sqsClient.ReceiveMessageAsync(request);
return response.Messages;
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public async Task DeleteMessage(SQSMessage message)
}
catch (Exception exc)
{
ReportErrorAndRethrow(exc, "GetMessages", ErrorCode.StreamProviderManagerBase);
ReportErrorAndRethrow(exc, "DeleteMessage", ErrorCode.StreamProviderManagerBase);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task<IList<IBatchContainer>> GetQueueMessagesAsync(int maxCount)
if (queueRef == null) return new List<IBatchContainer>();

int count = maxCount < 0 || maxCount == QueueAdapterConstants.UNLIMITED_GET_QUEUE_MSG ?
SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEAK : Math.Min(maxCount, SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEAK);
SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEEK : Math.Min(maxCount, SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEEK);

var task = queueRef.GetMessages(count);
outstandingTask = task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private async Task SendAndReceiveFromQueueAdapter(IQueueAdapterFactory adapterFa
{
while (receivedBatches < NumBatches)
{
var messages = receiver.GetQueueMessagesAsync(SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEAK).Result.ToArray();
var messages = receiver.GetQueueMessagesAsync(SQSStorage.MAX_NUMBER_OF_MESSAGE_TO_PEEK).Result.ToArray();
if (!messages.Any())
{
continue;
Expand Down