File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -339,14 +339,17 @@ func (th *telemetryHandle) Close(timeout int) {
339
339
340
340
// wait for items to be sent otherwise timeout
341
341
// similar to the example in the appinsights-go repo: https://github.com/microsoft/ApplicationInsights-Go#shutdown
342
+ timer := time .NewTimer (time .Duration (maxWaitTimeInSeconds ) * time .Second )
343
+ defer timer .Stop ()
342
344
select {
343
345
case <- th .client .Channel ().Close (time .Duration (timeout ) * time .Second ):
344
346
// timeout specified for retries.
345
347
346
348
// If we got here, then all telemetry was submitted
347
349
// successfully, and we can proceed to exiting.
348
- case <- time .After (time .Duration (maxWaitTimeInSeconds ) * time .Second ):
349
- // Thirty second absolute timeout. This covers any
350
+
351
+ case <- timer .C :
352
+ // absolute timeout. This covers any
350
353
// previous telemetry submission that may not have
351
354
// completed before Close was called.
352
355
You can’t perform that action at this time.
0 commit comments