Skip to content

Commit

Permalink
fix(scheduler): when there's no repositories got configured, skip the…
Browse files Browse the repository at this point in the history
… garbage collection
  • Loading branch information
wsxiaoys committed May 29, 2024
1 parent a4b8678 commit 8335d93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/tabby-scheduler/src/code/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ pub fn sync_repository(repository: &RepositoryConfig) {
pub fn garbage_collection(repositories: &[RepositoryConfig]) {
let names = repositories.iter().map(|r| r.dir()).collect::<HashSet<_>>();

for file in fs::read_dir(repositories_dir())
.expect("Failed to read repository dir")
.filter_map(Result::ok)
{
let Ok(dir) = fs::read_dir(repositories_dir()) else {
return;

Check warning on line 82 in crates/tabby-scheduler/src/code/repository.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/code/repository.rs#L81-L82

Added lines #L81 - L82 were not covered by tests
};

for file in dir.filter_map(Result::ok) {

Check warning on line 85 in crates/tabby-scheduler/src/code/repository.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/code/repository.rs#L85

Added line #L85 was not covered by tests
let metadata = file.metadata().expect("Failed to read metadata");
let filename = file.file_name();
if metadata.is_file() {
Expand Down

0 comments on commit 8335d93

Please sign in to comment.