-
Notifications
You must be signed in to change notification settings - Fork 9
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
#2172 - Retry Push for certain HTTP status codes #2266
Conversation
… 2172-push-retries
…/test_push_notifications.py::TestValidations::test_required_fields
…-affairs/notification-api into 2172-push-retries
… the VETTextNonRetryableException
…-affairs/notification-api into 2172-push-retries
…-affairs/notification-api into 2172-push-retries
app/celery/provider_tasks.py
Outdated
|
||
if retries < max_retries: | ||
if 'icn' in payload: | ||
payload['icn'] = '<redacted>' |
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.
If you redact the ICN here, won't the retry attempt to use <redacted>
instead of the icn? Or does this just affect the logs?
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.
That's a good question.
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.
Updated to deepcopy
the payload before redact
Retested
Co-authored-by: Cris Stoddard <111803622+cris-oddball@users.noreply.github.com>
app/celery/provider_tasks.py
Outdated
|
||
if retries < max_retries: | ||
if 'icn' in payload: | ||
payload['icn'] = '<redacted>' |
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.
That's a good question.
app/va/vetext/client.py
Outdated
self.logger.info('VEText response: %s', response.json() if response.ok else response.status_code) | ||
self.logger.debug( | ||
'VEText response: %s for payload %s', response.json() if response.ok else response.status_code, payload | ||
) |
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.
The debug log duplicates output from the preceding info log. Do we need to log the response json or status code twice in succession? Would including only the payload in the debug output be sufficient?
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.
Yes - This make is so much easy for the sake of testing - easy to link . We need the info
log for upper environments .
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.
Ditto Cris's question about changing the ICN value to "redacted". That's done twice in this file.
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.
Updated.
Description
issue #2172
The goal of this PR is to move logic to send VEText push notifications into a celery tasks. We added retry logic for the following statuses:
429, 500, 502, 503, 504
.#Changes in This PR
V2 Push Notifications
401
to403
deliver_push
and returnsV2PushPayload
dataclass.format_for_vetext
and returns dict.deliver_push
celery taskCelery Provider Tasks
deliver_push
celery task to handle push notifications usingvetext_client
, instead of being handled directly by the API.deliver_push
toSEND_EMAIL
queue.AutoRetryException
for transient failures.VEText Client
format_for_vetext
for formatting VEText Payload429, 500, 502, 503, 504
status codes,ConnectionTimeout
,ReadTimeout
Config Updates
app.celery.provider_tasks
in Celery imports.VETEXT_USERNAME
andVETEXT_PASSWORD
to celery task definitionsInternal REST API
/502
and/sleep
endpoints for debugging.Mobile App Registry
How Has This Been Tested?
Test Happy Path Push 201
/v2/notifications/push
200
201
from/v2/notification/push
Test Happy Path Push Broadcast 201
/v2/notifications/push/broadcast
200
201
from/v2/notification/push
Test Sad Path VEText Service Not Authorized 403
Remove push permissions from service
![Screenshot 2025-02-06 at 10 13 58 AM](https://private-user-images.githubusercontent.com/16658577/410518963-403c700d-6d7e-457a-be96-46c126644817.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODc4NzMsIm5iZiI6MTczOTM4NzU3MywicGF0aCI6Ii8xNjY1ODU3Ny80MTA1MTg5NjMtNDAzYzcwMGQtNmQ3ZS00NTdhLWJlOTYtNDZjMTI2NjQ0ODE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE5MTI1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ0OTkzOTJmMWUyOTA2NGFjOWM5Mjg3MWYzYjQ3NzgyMTBkNTUwMjVjNzZjY2FjMzkwNTQwNTZkNzAzZjYzMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.xwzFHh7SvSxeXCVS6kQXO0h28A0et8zpfSx7X07d_sY)
Confirm
403
from/v2/notification/push
when service unauthorizedTest Sad Path VETex Retrible Failure
/v2/notifications/push
500
response from VETest and push notification retried.Checklist