mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Added a 60 second timeout to the MMG and fire text clients.
- This is a CONNECT and a READ timeout. - Gets wrapped in the standard client exception, with a status code of 504, message Gateway timeout. - Is quiet noisy in logs to allow us to see it - Ensures we flick across the provider. To test change the timeout to 0 and it will timeout.
This commit is contained in:
@@ -42,8 +42,10 @@ def get_firetext_responses(status):
|
||||
|
||||
class FiretextClientResponseException(SmsClientResponseException):
|
||||
def __init__(self, response, exception):
|
||||
self.status_code = response.status_code
|
||||
self.text = response.text
|
||||
status_code = response.status_code if response is not None else 504
|
||||
text = response.text if response is not None else "Gateway Time-out"
|
||||
self.status_code = status_code
|
||||
self.text = text
|
||||
self.exception = exception
|
||||
|
||||
def __str__(self):
|
||||
@@ -68,11 +70,13 @@ class FiretextClient(SmsClient):
|
||||
return self.name
|
||||
|
||||
def record_outcome(self, success, response):
|
||||
status_code = response.status_code if response else 503
|
||||
|
||||
log_message = "API {} request {} on {} response status_code {}".format(
|
||||
"POST",
|
||||
"succeeded" if success else "failed",
|
||||
self.url,
|
||||
response.status_code
|
||||
status_code
|
||||
)
|
||||
|
||||
if success:
|
||||
|
||||
Reference in New Issue
Block a user