Skip to content

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Recursive .refact directories detection #834

wants to merge 6 commits into from

Conversation

MDario123
Copy link
Contributor

No description provided.

@MDario123 MDario123 changed the base branch from main to dev June 18, 2025 14:03
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>>()
));
Copy link
Contributor

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 {
Copy link
Contributor

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();
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants