Skip to content

Commit

Permalink
fix(webserver): /resolve/all should read from RepositoryService (#1796)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Apr 9, 2024
1 parent e111769 commit f628f5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/repositories/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ async fn meta(
}

async fn resolve(State(rs): State<Arc<ResolveState>>) -> Result<Response, StatusCode> {
rs.resolve_all().map_err(|_| StatusCode::NOT_FOUND)
rs.resolve_all().await.map_err(|_| StatusCode::NOT_FOUND)
}
16 changes: 9 additions & 7 deletions ee/tabby-webserver/src/repositories/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,17 @@ impl RepositoryCache {
None
}

pub fn resolve_all(&self) -> Result<Response> {
let entries: Vec<_> = self
.repository_lookup
.read()
.unwrap()
.keys()
pub async fn resolve_all(&self) -> Result<Response> {
let repositories = self
.service
.list_repositories(None, None, None, None)
.await?;

let entries = repositories
.into_iter()
.map(|repo| DirEntry {
kind: DirEntryKind::Dir,
basename: repo.repo_name.clone(),
basename: repo.name.clone(),
})
.collect();

Expand Down

0 comments on commit f628f5c

Please sign in to comment.