Skip to content

Commit 5cf08af

Browse files
authored
Merge pull request #2001 from GSA/noquota
add log statement when our send quota is used up
2 parents 57fdbd6 + a95269f commit 5cf08af

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/clients/cloudwatch/aws_cloudwatch.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from app.clients import AWS_CLIENT_CONFIG, Client
99
from app.cloudfoundry_config import cloud_config
10+
from app.utils import hilite
1011

1112

1213
class AwsCloudwatchClient(Client):
@@ -178,6 +179,19 @@ def check_delivery_receipts(self, start, end):
178179
)
179180
failed_event_set = self._get_receipts(log_group_name, start, end)
180181
current_app.logger.info((f"Failed message count: {len(failed_event_set)}"))
182+
raise_exception = False
183+
for failure in failed_event_set:
184+
try:
185+
failure = json.loads(failure)
186+
if "No quota left for account" == failure["delivery.providerResponse"]:
187+
current_app.logger.warning(
188+
hilite("**********NO QUOTA LEFT TO SEND MESSAGES!!!**********")
189+
)
190+
raise_exception = True
191+
except Exception:
192+
current_app.logger.exception("Malformed delivery receipt")
193+
if raise_exception:
194+
raise Exception("No Quota Left")
181195

182196
return delivered_event_set, failed_event_set
183197

0 commit comments

Comments
 (0)