From 14fd70219dec5162ee5b8bb0484b2f0fb7d4c7d5 Mon Sep 17 00:00:00 2001 From: Szymon Kulec Date: Thu, 17 Jan 2019 10:12:08 +0100 Subject: [PATCH 1/2] DataReader should be properly diposed in QueueLengthProvider --- .../QueueLengthProvider.cs | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/ServiceControl.Transports.SQLServer/QueueLengthProvider.cs b/src/ServiceControl.Transports.SQLServer/QueueLengthProvider.cs index 7864f7f..5cc39da 100644 --- a/src/ServiceControl.Transports.SQLServer/QueueLengthProvider.cs +++ b/src/ServiceControl.Transports.SQLServer/QueueLengthProvider.cs @@ -41,7 +41,7 @@ public void Process(EndpointInstanceId endpointInstanceId, EndpointMetadataRepor var localAddress = metadataReport.LocalAddress; var sqlTable = SqlTable.Parse(localAddress, defaultSchema); - + tableNames.AddOrUpdate(endpointInputQueue, _ => sqlTable, (_, currentSqlTable) => { if (currentSqlTable.Equals(sqlTable) == false) @@ -59,7 +59,7 @@ public void Process(EndpointInstanceId endpointInstanceId, TaggedLongValueOccurr { //HINT: Sql server endpoints do not support endpoint level queue length monitoring } - + public Task Start() { stop = new CancellationTokenSource(); @@ -110,7 +110,7 @@ void UpdateQueueLengthStore() { DateTicks = nowTicks, Value = tableSizes.TryGetValue(tableNamePair.Value, out var size) ? size : 0 - }}, + }}, tableNamePair.Key); } } @@ -144,24 +144,25 @@ async Task UpdateChunk(SqlConnection connection, KeyValuePair[] c using (var command = new SqlCommand(query, connection)) { - var reader = await command.ExecuteReaderAsync(token).ConfigureAwait(false); - - foreach (var chunkPair in chunk) + using (var reader = await command.ExecuteReaderAsync(token).ConfigureAwait(false)) { - await reader.ReadAsync(token).ConfigureAwait(false); + foreach (var chunkPair in chunk) + { + await reader.ReadAsync(token).ConfigureAwait(false); - var queueLength = reader.GetInt32(0); + var queueLength = reader.GetInt32(0); - if (queueLength == -1) - { - Logger.Warn($"Table {chunkPair.Key} does not exist."); - } - else - { - tableSizes.TryUpdate(chunkPair.Key, queueLength, chunkPair.Value); - } + if (queueLength == -1) + { + Logger.Warn($"Table {chunkPair.Key} does not exist."); + } + else + { + tableSizes.TryUpdate(chunkPair.Key, queueLength, chunkPair.Value); + } - await reader.NextResultAsync(token).ConfigureAwait(false); + await reader.NextResultAsync(token).ConfigureAwait(false); + } } } } From 5a322e5363aff7be1874bc4b50ffefc72c4243f2 Mon Sep 17 00:00:00 2001 From: Bob Langley Date: Mon, 4 Feb 2019 14:02:21 -0800 Subject: [PATCH 2/2] Update transport versions for ASQ, RabbitMQ, and SQL Transport. --- src/Packaging.NServiceBus.RabbitMQ/packages.config | 2 +- src/Packaging.NServiceBus.SQLServer/packages.config | 2 +- .../ServiceControl.Transports.AzureStorageQueues.csproj | 2 +- .../ServiceControl.Transports.RabbitMQ.csproj | 2 +- .../ServiceControl.Transports.SQLServer.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Packaging.NServiceBus.RabbitMQ/packages.config b/src/Packaging.NServiceBus.RabbitMQ/packages.config index 50c8be6..7a4f8db 100644 --- a/src/Packaging.NServiceBus.RabbitMQ/packages.config +++ b/src/Packaging.NServiceBus.RabbitMQ/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/src/Packaging.NServiceBus.SQLServer/packages.config b/src/Packaging.NServiceBus.SQLServer/packages.config index 09affe6..bbadd58 100644 --- a/src/Packaging.NServiceBus.SQLServer/packages.config +++ b/src/Packaging.NServiceBus.SQLServer/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/ServiceControl.Transports.AzureStorageQueues/ServiceControl.Transports.AzureStorageQueues.csproj b/src/ServiceControl.Transports.AzureStorageQueues/ServiceControl.Transports.AzureStorageQueues.csproj index 69b20ad..b8e935d 100644 --- a/src/ServiceControl.Transports.AzureStorageQueues/ServiceControl.Transports.AzureStorageQueues.csproj +++ b/src/ServiceControl.Transports.AzureStorageQueues/ServiceControl.Transports.AzureStorageQueues.csproj @@ -49,7 +49,7 @@ - 8.1.0 + 8.1.1 diff --git a/src/ServiceControl.Transports.RabbitMQ/ServiceControl.Transports.RabbitMQ.csproj b/src/ServiceControl.Transports.RabbitMQ/ServiceControl.Transports.RabbitMQ.csproj index 37dc591..19c6eac 100644 --- a/src/ServiceControl.Transports.RabbitMQ/ServiceControl.Transports.RabbitMQ.csproj +++ b/src/ServiceControl.Transports.RabbitMQ/ServiceControl.Transports.RabbitMQ.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/ServiceControl.Transports.SQLServer/ServiceControl.Transports.SQLServer.csproj b/src/ServiceControl.Transports.SQLServer/ServiceControl.Transports.SQLServer.csproj index 016d2d8..0dd1a11 100644 --- a/src/ServiceControl.Transports.SQLServer/ServiceControl.Transports.SQLServer.csproj +++ b/src/ServiceControl.Transports.SQLServer/ServiceControl.Transports.SQLServer.csproj @@ -55,7 +55,7 @@ - 4.1.0 + 4.1.1