Skip to content

Commit 353838b

Browse files
Cherry-Pick bug fixes for final 1.6 release (#2862)
## Why make this change? - The 1.6 release has a bug related to the new Azure Log Analytics feature. ## What is this change? Cherry-picked PR: - Bug Fix: - #2854 ## How was this tested? - [ ] Integration Tests - [X] Unit Tests
1 parent c1e6600 commit 353838b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/Service.Tests/Configuration/Telemetry/AzureLogAnalyticsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public async Task TestAzureLogAnalyticsFlushServiceSucceed(string message, LogLe
120120

121121
_ = Task.Run(() => flusherService.StartAsync(tokenSource.Token));
122122

123-
await Task.Delay(1000);
123+
await Task.Delay(2000);
124124

125125
// Assert
126126
AzureLogAnalyticsLogs actualLog = customClient.LogAnalyticsLogs[0];

src/Service/Telemetry/AzureLogAnalyticsCustomLogCollector.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ await _logs.Writer.WriteAsync(
5353
public async Task<List<AzureLogAnalyticsLogs>> DequeueAllAsync(string dabIdentifier, int flushIntervalSeconds)
5454
{
5555
List<AzureLogAnalyticsLogs> list = new();
56-
Stopwatch time = Stopwatch.StartNew();
5756

5857
if (await _logs.Reader.WaitToReadAsync())
5958
{
60-
while (_logs.Reader.TryRead(out AzureLogAnalyticsLogs? item))
59+
Stopwatch time = Stopwatch.StartNew();
60+
61+
while (true)
6162
{
62-
item.Identifier = dabIdentifier;
63-
list.Add(item);
63+
if (_logs.Reader.TryRead(out AzureLogAnalyticsLogs? item))
64+
{
65+
item.Identifier = dabIdentifier;
66+
list.Add(item);
67+
}
6468

6569
if (time.Elapsed >= TimeSpan.FromSeconds(flushIntervalSeconds))
6670
{

0 commit comments

Comments
 (0)