-
Notifications
You must be signed in to change notification settings - Fork 175
Recursive .refact directories detection #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
let mut gcx_locked = gcx.write().await; | ||
gcx_locked.documents_state.dot_refact_folders = Arc::new(AMutex::new( | ||
visited.into_iter().filter(|p| p.ends_with(".refact")).collect::<Vec<PathBuf>>() | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we're just dropping a lock to create one again, just modify .indexing_anywhere and return cache_dirty without releasing and acquiring lock again
if let Some(gcx) = gcx_weak.clone().upgrade() { | ||
let dot_refact_folders_arc = gcx.read().await.documents_state.dot_refact_folders.clone(); | ||
let mut dot_refact_folders = dot_refact_folders_arc.lock().await; | ||
match event.kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small thing, but logic could be simplified by just always doing what it's done in the modification case, retain and then add if exists, could remove some branching, and then based on event.kind just log, but it's not very important
(config_dirs, global_config_dir) | ||
} | ||
|
||
pub fn split_path_into_project_and_integration(cfg_path: &PathBuf) -> Result<(String, String), String> { | ||
static RE_PER_PROJECT: OnceLock<Regex> = OnceLock::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest doing this based on .components(), and simple comparisons, instead of regex, since we already had &Path before
|
||
let mut integrations_missing: HashSet<&str> = HashSet::from_iter(lst.iter().cloned()); | ||
|
||
// Find integrations present in config_dir/integrations.d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks clear from next line, no need to comment
// Find integrations present in config_dir/integrations.d | ||
if let Ok(mut entries) = tokio::fs::read_dir(config_dir.join("integrations.d")).await { | ||
while let Ok(Some(entry)) = entries.next_entry().await { | ||
// Get filename without extension or ignore if extension is not yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks clear from next line, no need to comment
} | ||
} | ||
|
||
// If there are integrations that were not found in the config_dir/integrations.d, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we need to get rid of this, maybe not now, but we need to test if removing this won't cause any issue, it's not nice to have this non existent records for no reason, maybe we can keep it only for global config and that could be enough for the UI? not sure, needs to be tested
No description provided.