File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 3737 time_interval. tick ( ) . await ;
3838 let result = function ( ) . await ;
3939 match result {
40- Ok ( value) => tx. send ( value) . expect ( "Failed to update channel" ) ,
40+ Ok ( value) => {
41+ if tx. send ( value) . is_err ( ) {
42+ tracing:: debug!( "Watcher channel closed, stopping watcher task" ) ;
43+ break ;
44+ }
45+ }
4146 Err ( err) => {
4247 // TODO mark it as delayed
4348 tracing:: warn!( error = %err, "There was an error while updating watcher" ) ;
7984 let current_val_1 = receiver_1. borrow ( ) . clone ( ) ;
8085 let current_val_2 = receiver_2. borrow ( ) . clone ( ) ;
8186 let mapped_value = map_function ( ( current_val_1, current_val_2) ) ;
82- tx. send ( mapped_value) . expect ( "Failed to update channel" ) ;
87+ if tx. send ( mapped_value) . is_err ( ) {
88+ tracing:: debug!( "Watcher channel closed, stopping combined watcher task" ) ;
89+ break ;
90+ }
8391 }
8492 } ) ;
8593 rx
@@ -138,7 +146,10 @@ where
138146
139147 let current_val = receiver. borrow ( ) . clone ( ) ;
140148 let mapped_value = map_function ( current_val) ;
141- tx. send ( mapped_value) . expect ( "Failed to update channel" ) ;
149+ if tx. send ( mapped_value) . is_err ( ) {
150+ tracing:: debug!( "Watcher channel closed, stopping mapped watcher task" ) ;
151+ break ;
152+ }
142153 }
143154 } ) ;
144155 rx
You can’t perform that action at this time.
0 commit comments