-
Notifications
You must be signed in to change notification settings - Fork 126
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
feat : Show dependencies dependents count #342 #857
base: main
Are you sure you want to change the base?
feat : Show dependencies dependents count #342 #857
Conversation
let deps = db | ||
.list_package_version_dependencies(&scope, &package, &latest_version) | ||
.await?; | ||
|
||
api_package.dependency_count = { | ||
let mut unique_deps = HashSet::new(); | ||
deps | ||
.iter() | ||
.filter(|dep| unique_deps.insert(&dep.dependency_name)) | ||
.count() as u64 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe convert this to a database COUNT as well, especially since this is an active hotpath and recomputing this constantly seems a bit unecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i'll do it.
@BorisLord overall this PR looks good to me; any reason this is marked as a draft? |
@crowlKats There's no longer a good reason being marked at draft Thx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just waiting on the change to use a database COUNT instead of manual
Fixes #342.
I think a should export some code to improve visibility in of the
get_handler
function inpackage.rs
into an other file but where ?utils.rs
?Ready to read suggestions and make changes if needed !