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

Action policy/speedup #858

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Action policy/speedup #858

wants to merge 10 commits into from

Conversation

deepsidhu85
Copy link
Contributor

@deepsidhu85 deepsidhu85 commented Nov 29, 2024

What does this PR do and why?

Describe in detail what your merge request does and why.

This PR refactors the project namespace, project, and group policies so that the access level is only retrieved once during the initialization which cuts down on the number of queries to the database.

Some benchmarks from accessing the samples page for streptococcus and descendant groups:

http://localhost:3000/-/groups/streptococcus/-/samples

main: Completed 200 OK in 502ms (Views: 370.9ms | ActiveRecord: 57.8ms (80 queries, 31 cached) | GC: 25.4ms)

actionpolicy speedup: Completed 200 OK in 396ms (Views: 267.2ms | ActiveRecord: 52.3ms (60 queries, 11 cached) | GC: 23.5ms)



http://localhost:3000/-/groups/streptococcus/streptococcus-pyogenes/-/samples

main: Completed 200 OK in 427ms (Views: 296.7ms | ActiveRecord: 49.8ms (76 queries, 32 cached) | GC: 20.8ms)

actionpolicy speedup: Completed 200 OK in 426ms (Views: 297.2ms | ActiveRecord: 55.6ms (56 queries, 12 cached) | GC: 8.0ms)



http://localhost:3000/streptococcus/streptococcus-pyogenes/streptococcus-pyogenes-m92/outbreak-2023/-/samples

main: Completed 200 OK in 1526ms (Views: 984.4ms | ActiveRecord: 66.6ms (97 queries, 84 cached) | GC: 332.5ms)

actionpolicy speedup: Completed 200 OK in 191ms (Views: 129.4ms | ActiveRecord: 19.8ms (22 queries, 9 cached) | GC: 2.5ms)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

This comment has been minimized.

This comment has been minimized.

@deepsidhu85 deepsidhu85 self-assigned this Dec 4, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

ericenns and others added 10 commits December 13, 2024 09:40
…es to get project with namespace and parent namespace for routing
…itialization and use that to determine permissions
…nding on if the params includes group links or not, and to set if the token is active for an uploader.
… to get the effective access level on initialize
…ctive_access_level method which will get the access level if group links are included or not. Reverted changes to views for passing in include_group_links in the context
…e. Also updated project policy method for transfer sample into project to use the set effective level
…red. Removed commented out code from policies
@deepsidhu85 deepsidhu85 force-pushed the action_policy/speedup branch from df838f8 to a51b153 Compare December 13, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants