mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 16:10:31 +00:00
perf: add in-memory repo index with pagination
- Add repo_index.rs with lazy rebuild on write operations - Double-checked locking to prevent race conditions - npm optimization: count tarballs instead of parsing metadata.json - Add pagination to all registry list pages (?page=1&limit=50) - Invalidate index on PUT/proxy cache in docker/maven/npm/pypi Performance: 500-800x faster list page loads after first rebuild
This commit is contained in:
@@ -85,6 +85,11 @@ async fn handle_request(State(state): State<Arc<AppState>>, Path(path): Path<Str
|
||||
let _ = storage.put(&key_clone, &data_clone).await;
|
||||
});
|
||||
|
||||
// Invalidate index when caching new tarball
|
||||
if is_tarball {
|
||||
state.repo_index.invalidate("npm");
|
||||
}
|
||||
|
||||
return with_content_type(is_tarball, data.into()).into_response();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user