File tree 1 file changed +13
-6
lines changed
opentelemetry-sdk/src/metrics
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -415,14 +415,21 @@ impl PeriodicReaderInner {
415
415
. send ( Message :: Shutdown ( response_tx) )
416
416
. map_err ( |e| MetricError :: Other ( e. to_string ( ) ) ) ?;
417
417
418
- if let Ok ( response) = response_rx. recv ( ) {
419
- if response {
420
- Ok ( ( ) )
421
- } else {
418
+ // TODO: Make this timeout configurable.
419
+ match response_rx. recv_timeout ( Duration :: from_secs ( 5 ) ) {
420
+ Ok ( response) => {
421
+ if response {
422
+ Ok ( ( ) )
423
+ } else {
424
+ Err ( MetricError :: Other ( "Failed to shutdown" . into ( ) ) )
425
+ }
426
+ }
427
+ Err ( mpsc:: RecvTimeoutError :: Timeout ) => Err ( MetricError :: Other (
428
+ "Failed to shutdown due to Timeout" . into ( ) ,
429
+ ) ) ,
430
+ Err ( mpsc:: RecvTimeoutError :: Disconnected ) => {
422
431
Err ( MetricError :: Other ( "Failed to shutdown" . into ( ) ) )
423
432
}
424
- } else {
425
- Err ( MetricError :: Other ( "Failed to shutdown" . into ( ) ) )
426
433
}
427
434
}
428
435
}
You can’t perform that action at this time.
0 commit comments