File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,10 @@ async fn watch_file_task(
184
184
loop {
185
185
// Wait for stop or the next check interval.
186
186
tokio:: select! {
187
- _ = & mut stop_rx => break ,
187
+ _ = & mut stop_rx => {
188
+ eprintln!( "Stopping file watcher" ) ;
189
+ break ;
190
+ } ,
188
191
_ = tokio:: time:: sleep( options. check_interval) => {
189
192
// Check if the file has been rotated or truncated.
190
193
match std:: fs:: metadata( & path) {
@@ -217,6 +220,7 @@ async fn watch_file_task(
217
220
if curr_len > last_pos {
218
221
// Read the new part.
219
222
if let Err ( e) = file. seek( SeekFrom :: Start ( last_pos) ) {
223
+ eprintln!( "Error seeking to position: {}" , e) ;
220
224
let _ = content_tx. send( Err ( anyhow:: anyhow!( e) ) ) . await ;
221
225
break ;
222
226
}
@@ -231,13 +235,15 @@ async fn watch_file_task(
231
235
}
232
236
Ok ( _) => { }
233
237
Err ( e) => {
238
+ eprintln!( "Error reading from file: {}" , e) ;
234
239
let _ = content_tx. send( Err ( anyhow:: anyhow!( e) ) ) . await ;
235
240
break ;
236
241
}
237
242
}
238
243
} else {
239
244
// Reached EOF, check if the timeout has been reached.
240
245
if Instant :: now( ) . duration_since( last_activity) > options. timeout {
246
+ eprintln!( "Timeout reached, breaking" ) ;
241
247
break ;
242
248
}
243
249
}
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ mod tests {
60
60
}
61
61
62
62
// Stop watching.
63
+ println ! ( "Stopping stream" ) ;
63
64
stream. stop ( ) ;
64
65
65
66
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments