Skip to content

Commit

Permalink
Prevent usage of reference across ref boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
lorefnon committed Jan 19, 2024
1 parent 829bb3e commit 6f66707
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,17 @@ impl<T: AsyncFromStrWithState> FileCache<T> {
log::trace!("Cache answer without filesystem lookup for {:?}", path);
return Ok(Arc::clone(&cached.content));
}
match app_state
let modified_res = app_state
.file_system
.modified_since(app_state, path, cached.last_check_time(), true)
.await
{
.modified_since(app_state, path, cached.last_check_time(), true);
drop(cached);
match modified_res.await {
Ok(false) => {
log::trace!("Cache answer with filesystem metadata read for {:?}", path);
cached.update_check_time();
return Ok(Arc::clone(&cached.content));
if let Some(cached) = self.cache.get(path) {
cached.update_check_time();
return Ok(Arc::clone(&cached.content));
}
}
Ok(true) => log::trace!("{path:?} was changed, updating cache..."),
Err(e) => log::trace!("Cannot read metadata of {path:?}, re-loading it: {e:#}"),
Expand Down

0 comments on commit 6f66707

Please # to comment.