@@ -64,31 +64,6 @@ pub(crate) async fn getlog_handler(
6464 . map_err ( |err| RpcError :: new ( RpcErrorCode :: InternalError , format ! ( "Cannot read log files: {err}" ) ) ) ?;
6565 log_files. sort_by_key ( |entry| entry. file_name ( ) ) ;
6666
67- // Skip files with no journal entries
68- let log_files = tokio_stream:: iter ( log_files)
69- . filter ( |file_entry| {
70- let file_path = file_entry. path ( ) ;
71- async move {
72- match tokio:: fs:: File :: open ( & file_path) . await {
73- Ok ( file) => {
74- if file_path. to_string_lossy ( ) . ends_with ( ".log3" ) {
75- JournalReaderLog3 :: new ( BufReader :: new ( file. compat ( ) ) ) . next ( ) . await . is_some ( )
76- } else {
77- JournalReaderLog2 :: new ( BufReader :: new ( file. compat ( ) ) ) . next ( ) . await . is_some ( )
78- }
79- }
80- Err ( err) => {
81- error ! ( "Cannot open file {file_path} in call to getLog: {err}" ,
82- file_path = file_path. to_string_lossy( )
83- ) ;
84- false
85- }
86- }
87- }
88- } )
89- . collect :: < Vec < _ > > ( )
90- . await ;
91-
9267 let file_start_index: usize = {
9368 if log_files. is_empty ( ) {
9469 0
@@ -114,7 +89,32 @@ pub(crate) async fn getlog_handler(
11489 }
11590 } ;
11691
117- let file_readers = tokio_stream:: iter ( & log_files[ file_start_index..] )
92+ // Skip files with no journal entries
93+ let log_files = tokio_stream:: iter ( & log_files[ file_start_index..] )
94+ . filter ( |file_entry| {
95+ let file_path = file_entry. path ( ) ;
96+ async move {
97+ match tokio:: fs:: File :: open ( & file_path) . await {
98+ Ok ( file) => {
99+ if file_path. to_string_lossy ( ) . ends_with ( ".log3" ) {
100+ JournalReaderLog3 :: new ( BufReader :: new ( file. compat ( ) ) ) . next ( ) . await . is_some ( )
101+ } else {
102+ JournalReaderLog2 :: new ( BufReader :: new ( file. compat ( ) ) ) . next ( ) . await . is_some ( )
103+ }
104+ }
105+ Err ( err) => {
106+ error ! ( "Cannot open file {file_path} in call to getLog: {err}" ,
107+ file_path = file_path. to_string_lossy( )
108+ ) ;
109+ false
110+ }
111+ }
112+ }
113+ } )
114+ . collect :: < Vec < _ > > ( )
115+ . await ;
116+
117+ let file_readers = tokio_stream:: iter ( log_files)
118118 . then ( |file_entry| async {
119119 let file_path = file_entry. path ( ) ;
120120 tokio:: fs:: File :: open ( & file_path)
0 commit comments