File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,14 +85,14 @@ impl Worker {
8585
8686 async fn run ( mut self ) {
8787 let queue_ready = self . tasks . read ( ) . await . subscribe ( ) ;
88- self . status = self . command_rx . borrow ( ) . to_owned ( ) ;
88+ self . refresh_status ( ) ;
8989 loop {
9090 tokio:: select! {
9191 _ = self . exit_signal. cancelled( ) => {
9292 break ;
9393 }
9494 _ = self . command_rx. changed( ) => {
95- self . status = self . command_rx. borrow ( ) . to_owned( ) ;
95+ self . status = self . command_rx. borrow_and_update ( ) . to_owned( ) ;
9696 self . process_inner( ) . await ;
9797 }
9898 _ = queue_ready. notified( ) => {
@@ -102,12 +102,17 @@ impl Worker {
102102 }
103103 }
104104
105+ fn refresh_status ( & mut self ) {
106+ self . status = self . command_rx . borrow ( ) . to_owned ( ) ;
107+ }
108+
105109 async fn process_inner ( & mut self ) {
106110 loop {
107111 if self . exit_signal . is_cancelled ( ) {
108112 info ! ( "Verify worker::process_inner exit_signal is cancelled" ) ;
109113 return ;
110114 }
115+ self . refresh_status ( ) ;
111116 if self . status != ChunkCommand :: Resume {
112117 return ;
113118 }
@@ -116,6 +121,11 @@ impl Worker {
116121 return ;
117122 }
118123
124+ self . refresh_status ( ) ;
125+ if self . status != ChunkCommand :: Resume {
126+ return ;
127+ }
128+
119129 // pick a entry to run verify
120130 let entry = {
121131 let mut tasks = self . tasks . write ( ) . await ;
You can’t perform that action at this time.
0 commit comments