mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 10:03:38 -04:00
add log statement when our send quota is used up
This commit is contained in:
@@ -7,6 +7,7 @@ from flask import current_app
|
|||||||
|
|
||||||
from app.clients import AWS_CLIENT_CONFIG, Client
|
from app.clients import AWS_CLIENT_CONFIG, Client
|
||||||
from app.cloudfoundry_config import cloud_config
|
from app.cloudfoundry_config import cloud_config
|
||||||
|
from app.utils import hilite
|
||||||
|
|
||||||
|
|
||||||
class AwsCloudwatchClient(Client):
|
class AwsCloudwatchClient(Client):
|
||||||
@@ -179,6 +180,13 @@ class AwsCloudwatchClient(Client):
|
|||||||
failed_event_set = self._get_receipts(log_group_name, start, end)
|
failed_event_set = self._get_receipts(log_group_name, start, end)
|
||||||
current_app.logger.info((f"Failed message count: {len(failed_event_set)}"))
|
current_app.logger.info((f"Failed message count: {len(failed_event_set)}"))
|
||||||
|
|
||||||
|
for failure in failed_event_set:
|
||||||
|
failure = json.loads(failure)
|
||||||
|
if "No quota left for account" == failure["delivery.providerResponse"]:
|
||||||
|
current_app.logger.warning(
|
||||||
|
hilite("**********NO QUOTA LEFT TO SEND MESSAGES!!!**********")
|
||||||
|
)
|
||||||
|
|
||||||
return delivered_event_set, failed_event_set
|
return delivered_event_set, failed_event_set
|
||||||
|
|
||||||
def _get_receipts(self, log_group_name, start, end):
|
def _get_receipts(self, log_group_name, start, end):
|
||||||
|
|||||||
Reference in New Issue
Block a user