-
Notifications
You must be signed in to change notification settings - Fork 202
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
Override throttle rate for each endpoint #993
Conversation
Signed-off-by: Tushar Goel <[email protected]>
a00bb4e
to
f1b53d3
Compare
Signed-off-by: Tushar Goel <[email protected]>
vulnerabilities/throttling.py
Outdated
class VulnerablePackagesAPIThrottle(StaffUserRateThrottle): | ||
scope = "vulnerable_packages" | ||
|
||
|
||
class BulkSearchPackagesAPIThrottle(StaffUserRateThrottle): | ||
scope = "bulk_search_packages" | ||
|
||
|
||
class PackagesAPIThrottle(StaffUserRateThrottle): | ||
scope = "packages" | ||
|
||
|
||
class VulnerabilitiesAPIThrottle(StaffUserRateThrottle): | ||
scope = "vulnerabilities" | ||
|
||
|
||
class AliasesAPIThrottle(StaffUserRateThrottle): | ||
scope = "aliases" | ||
|
||
|
||
class CPEAPIThrottle(StaffUserRateThrottle): | ||
scope = "cpes" | ||
|
||
|
||
class BulkSearchCPEAPIThrottle(StaffUserRateThrottle): | ||
scope = "bulk_search_cpes" |
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.
There's no better way to do this? It looks like a lot of duplication here.
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.
I have now used ScopeRatedThrottling, please see if it looks good
Signed-off-by: Tushar Goel <[email protected]>
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.
Much better!
No description provided.