We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb69777 commit 6fe2350Copy full SHA for 6fe2350
src/Common/Commands.Common/MetricHelper.cs
@@ -14,6 +14,7 @@ namespace Microsoft.WindowsAzure.Commands.Common
14
{
15
public static class MetricHelper
16
17
+ private const int FlushTimeoutInMilli = 5000;
18
private static readonly TelemetryClient TelemetryClient;
19
20
static MetricHelper()
@@ -94,13 +95,10 @@ public static void FlushMetric(bool waitForMetricSending)
94
95
return;
96
}
97
98
+ var flushTask = Task.Run(() => FlushAi());
99
if (waitForMetricSending)
100
- FlushAi();
- }
101
- else
102
- {
103
- Task.Run(() => FlushAi());
+ Task.WaitAll(new[] { flushTask }, FlushTimeoutInMilli);
104
105
106
0 commit comments