Skip to content
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

Remove unnecessary concurrency on Project Detail page #4634

Open
mikerkelly opened this issue Oct 1, 2024 · 0 comments
Open

Remove unnecessary concurrency on Project Detail page #4634

mikerkelly opened this issue Oct 1, 2024 · 0 comments
Labels
deck-scrubbing Tech debt or other between-initiative tidy-up work

Comments

@mikerkelly
Copy link
Contributor

mikerkelly commented Oct 1, 2024

The ProjectDetailView uses the concurrent Python module to parallelise Github API requests through github.get_repo_is_private(). This is unnecessary and over-complicated and makes reasoning about and maintaining the code more complicated than necessary (ref #4591). It's also inefficient to open a separate connection for each item as the connection and API endpoint overheads are higher than a bulk request.

The more typical approach would be for the endpoint to provide a method to do a bulk request with a single API access (possibly paginated/chunked if needed due to a max size limit). If we look in the github module (our thin-wrapper around requests and the GitHub API), we can see that functions like get_repos_with_branches and get_repos_with_dates follow this approach with GraphQL API accesses. We can write a new get_repos_with_privacy or whatever function and eliminate this idiosyncratic use of concurrency.

Generally, we should avoid using concurrency unless we need it to avoid over-complication. This is the only use of the concurrent module across the entire repo. It looks like it was done for expediency or as an experiment. The other two clients of github.get_repo_is_private() (WorkspaceDetail and SignOffRepo views) use this function for a single request, which is reasonable.

We might consider refactoring the commonality of the GraphQL code in github.py alongside doing this. Or put that in a separate issue. That might take inspiration from the metrics codebase approach but note this is a CLI-tool so there may be some differences in desired behavior.

@mikerkelly mikerkelly added the deck-scrubbing Tech debt or other between-initiative tidy-up work label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deck-scrubbing Tech debt or other between-initiative tidy-up work
Projects
None yet
Development

No branches or pull requests

1 participant