switch to rocket::launch

refactor cache setup function
remove lazy_static dep, replace with OnceLock
This commit is contained in:
2024-11-30 22:08:47 -05:00
parent 69e8d97e3b
commit 537abe32c1
5 changed files with 82 additions and 77 deletions

View File

@@ -244,13 +244,13 @@ impl FileCache {
// do nothing, this is sent when a file is being removed
}
DebouncedEvent::Create(p) => {
match crate::FILECACHE.add(p.as_path()) {
match crate::filecache().add(p.as_path()) {
Ok(hash) => log::info!("[{}] Found new file @ {} ({})",thread_name, &p.as_path().to_string_lossy(), hash.to_string()),
Err(e) => log::error!("[{}] Found a new file but there was an error adding to internal cache\nFile -> {} \nError -> {:#?}", thread_name, &p.as_path().to_string_lossy(), &e),
}
}
DebouncedEvent::Write(p) => {
match crate::FILECACHE.add(p.as_path()) {
match crate::filecache().add(p.as_path()) {
Ok(hash) => log::info!("[{}] A file was updated @ {} ({})",thread_name, &p.as_path().to_string_lossy(), hash.to_string()),
Err(e) => log::error!("[{}] Found a new file but there was an error updating the internal cache\nFile -> {} \nError -> {:#?}", thread_name, &p.as_path().to_string_lossy(), &e),
}