Skip to content

Commit 86a574c

Browse files
authored
Merge pull request #204495 from AaronMaxwell/aaronmax-update-flush-note
Commenting Task.Delay(5000)
2 parents d7cb1fd + 5118685 commit 86a574c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

articles/azure-monitor/app/console.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,14 @@ namespace ConsoleApp
169169
// before exit, flush the remaining data
170170
telemetryClient.Flush();
171171

172-
// flush is not blocking when not using InMemoryChannel so wait a bit. There is an active issue regarding the need for `Sleep`/`Delay`
173-
// which is tracked here: https://github.com/microsoft/ApplicationInsights-dotnet/issues/407
172+
// Console apps should use the WorkerService package.
173+
// This uses ServerTelemetryChannel which does not have synchronous flushing.
174+
// For this reason we add a short 5s delay in this sample.
175+
174176
Task.Delay(5000).Wait();
175177

178+
// If you're using InMemoryChannel, Flush() is synchronous and the short delay is not required.
179+
176180
}
177181

178182
static DependencyTrackingTelemetryModule InitializeDependencyTracking(TelemetryConfiguration configuration)

0 commit comments

Comments
 (0)