From 712150d7b33af2ba6ac471476487cab7b791672e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 02 Jan 2026 14:27:28 -0600 Subject: [PATCH] git/indexer: Start with more gitoxide slot space; reduce #22 --- src/database/indexer.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/database/indexer.rs b/src/database/indexer.rs index 0804c8a..d83ad3b 100644 --- a/src/database/indexer.rs +++ b/src/database/indexer.rs @@ -39,6 +39,10 @@ info!("Starting index update"); + // TODO: Somewhere in here, we need to check repo.objects.store_ref().metrics().unused_slots + // for each repository, and close / reopen the repo with gixoxide to avoid running out of available + // slots. See codeberg.org/kallisti5/gitore/issues/22. + update_repository_metadata(scan_path, repository_list, db); update_repository_reflog(scan_path, db.clone()); update_repository_tags(scan_path, db.clone()); @@ -602,6 +606,19 @@ fn get_relative_path<'a>(relative_to: &Path, full_path: &'a Path) -> Option<&'a Path> { full_path.strip_prefix(relative_to).ok() +} + +/// Helps reduce the frequency of repo reopens to enlarge slots in gitoxide +/// see https://github.com/GitoxideLabs/gitoxide/issues/1788 +fn gix_open_options() -> gix::open::Options { + gix::open::Options::default() + .object_store_slots( + gix::odb::store::init::Slots::AsNeededByDiskState { + multiplier: 1.5, + minimum: 512, + } + ) + .open_path_as_is(true) } fn discover_repositories( @@ -651,7 +668,7 @@ }; for dir in dirs { - match gix::open_opts(&dir, gix::open::Options::default().open_path_as_is(true)) { + match gix::open_opts(&dir, gix_open_options()) { Ok(mut repo) => { repo.object_cache_size(10 * 1024 * 1024); discovered_repos.push((dir, repo)); -- gitore 0.2.3