Skip to content

Commit 305c283

Browse files
Copilotsamtrion
andcommitted
refactor: address code review feedback on AzureQueueStorage transport
Agent-Logs-Url: https://github.com/dailydevops/pulse/sessions/46d27db2-a16d-482b-8d30-a7fa998b9eb8 Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
1 parent 6a7d831 commit 305c283

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/NetEvolve.Pulse.AzureQueueStorage/Outbox/AzureQueueStorageMessageTransport.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ namespace NetEvolve.Pulse.Outbox;
2020
/// </remarks>
2121
public sealed class AzureQueueStorageMessageTransport : IMessageTransport, IDisposable
2222
{
23-
internal const int MaxMessageSizeInBytes = 48 * 1024; // 48 KB
23+
internal const int MaxMessageSizeInBytes = 48 * 1024; // Raw 48 KB limit (64 KB after Base64 encoding)
2424

2525
private readonly AzureQueueStorageTransportOptions _options;
2626
private readonly QueueClient? _queueClientOverride;
2727
private readonly SemaphoreSlim _initLock = new SemaphoreSlim(1, 1);
28-
29-
// Volatile ensures the double-checked locking pattern is correct across threads.
30-
private volatile QueueClient? _queueClient;
28+
private QueueClient? _queueClient;
3129

3230
/// <summary>
3331
/// Initializes a new instance of the <see cref="AzureQueueStorageMessageTransport"/> class.
@@ -143,7 +141,7 @@ private async Task<QueueClient> GetQueueClientAsync(CancellationToken cancellati
143141
}
144142
else
145143
{
146-
var queueUri = new Uri($"{_options.QueueServiceUri!.AbsoluteUri.TrimEnd('/')}/{_options.QueueName}");
144+
var queueUri = new Uri(_options.QueueServiceUri!, _options.QueueName);
147145
client = new QueueClient(queueUri, new DefaultAzureCredential());
148146
}
149147

tests/NetEvolve.Pulse.Tests.Unit/AzureQueueStorage/AzureQueueStorageMessageTransportTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private sealed class FakeQueueClient : QueueClient
244244
[System.Diagnostics.CodeAnalysis.SuppressMessage(
245245
"Reliability",
246246
"CA2000:Dispose objects before losing scope",
247-
Justification = "FakeAzureResponse.Dispose is a no-op; suppressed for test code."
247+
Justification = "FakeAzureResponse is passed to Response.FromValue and immediately returned; its Dispose is a no-op."
248248
)]
249249
public override Task<Response<SendReceipt>> SendMessageAsync(
250250
string messageText,
@@ -268,7 +268,7 @@ public override Task<Response<SendReceipt>> SendMessageAsync(
268268
[System.Diagnostics.CodeAnalysis.SuppressMessage(
269269
"Reliability",
270270
"CA2000:Dispose objects before losing scope",
271-
Justification = "FakeAzureResponse.Dispose is a no-op; suppressed for test code."
271+
Justification = "FakeAzureResponse is immediately returned as the raw response; its Dispose is a no-op."
272272
)]
273273
public override Task<Response> CreateIfNotExistsAsync(
274274
IDictionary<string, string>? metadata = null,

0 commit comments

Comments
 (0)