mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Ensure clients have rate limit enforced
- rate limiting is a hard number per day - not limited in terms of rate of request - limit is a single number held against the service - every notification counts against the limit, regardless of type - return a 429 if limit exceeded.
This commit is contained in:
@@ -11,6 +11,13 @@ def dao_get_notification_statistics_for_service(service_id):
|
||||
).order_by(desc(NotificationStatistics.day)).all()
|
||||
|
||||
|
||||
def dao_get_notification_statistics_for_service_and_day(service_id, day):
|
||||
return NotificationStatistics.query.filter_by(
|
||||
service_id=service_id,
|
||||
day=day
|
||||
).order_by(desc(NotificationStatistics.day)).first()
|
||||
|
||||
|
||||
def dao_create_notification(notification, notification_type):
|
||||
try:
|
||||
if notification.job_id:
|
||||
|
||||
Reference in New Issue
Block a user