File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
opentelemetry-sdk/src/metrics Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -415,14 +415,21 @@ impl PeriodicReaderInner {
415415 . send ( Message :: Shutdown ( response_tx) )
416416 . map_err ( |e| MetricError :: Other ( e. to_string ( ) ) ) ?;
417417
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 ) => {
422431 Err ( MetricError :: Other ( "Failed to shutdown" . into ( ) ) )
423432 }
424- } else {
425- Err ( MetricError :: Other ( "Failed to shutdown" . into ( ) ) )
426433 }
427434 }
428435}
You can’t perform that action at this time.
0 commit comments