Skip to content

Commit

Permalink
Fix typos in SQSStorage.cs (#8933)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malpp committed Apr 5, 2024
1 parent 760a4cd commit 2960a3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/AWS/Orleans.Streaming.SQS/Storage/SQSStorage.cs
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
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
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

0 comments on commit 2960a3b

Please sign in to comment.