File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -79,12 +79,19 @@ impl<T: AsyncFromStrWithState> FileCache<T> {
7979 log:: trace!( "Cache answer without filesystem lookup for {:?}" , path) ;
8080 return Ok ( Arc :: clone ( & cached. content ) ) ;
8181 }
82- if let Ok ( modified) = tokio:: fs:: metadata ( path) . await . and_then ( |m| m. modified ( ) ) {
83- if modified <= cached. last_check_time ( ) {
84- log:: trace!( "Cache answer with filesystem metadata read for {:?}" , path) ;
85- cached. update_check_time ( ) ;
86- return Ok ( Arc :: clone ( & cached. content ) ) ;
82+ let modified_res = tokio:: fs:: metadata ( path) . await . and_then ( |m| m. modified ( ) ) ;
83+ match modified_res {
84+ Ok ( modified) => {
85+ if modified <= cached. last_check_time ( ) {
86+ log:: trace!( "Cache answer with filesystem metadata read for {:?}" , path) ;
87+ cached. update_check_time ( ) ;
88+ return Ok ( Arc :: clone ( & cached. content ) ) ;
89+ }
8790 }
91+ Err ( e) => log:: warn!(
92+ "Unable to check when '{}' was last modified. Re-reading the file: {e:#}" ,
93+ path. display( )
94+ ) ,
8895 }
8996 }
9097 // Read lock is released
You can’t perform that action at this time.
0 commit comments