-
Notifications
You must be signed in to change notification settings - Fork 18
Process ses results wrapper #2519
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
base: main
Are you sure you want to change the base?
Conversation
- Added doc strings - Improve clarity of existing comments
- Moved the json loading out of the lambda to improve lambda performance. It is now handled here in the celery task - Fixed an issue where the task retry args were getting wrapped in a list when the arg was already a list, causing retries to fail processing
@@ -29,8 +103,160 @@ | |||
max_retries=5, | |||
default_retry_delay=300, | |||
) | |||
def process_ses_results(self, response): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
To fix the issue, we will add an explicit return statement at the end of the process_ses_results
function. This ensures that the function always returns a value explicitly, even when neither messages
nor message
is present in the response
. The explicit return value will be None
, as this aligns with the current behavior of the function when no conditions are met.
-
Copy modified line R120
@@ -119,3 +119,3 @@ | ||
return unbatched_process_ses_results(self, response) | ||
|
||
return None | ||
|
|
||
|
||
@statsd(namespace="tasks") | ||
def batched_process_ses_results(self, response): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
To fix the issue, we will add an explicit return statement at the end of the batched_process_ses_results
function. This ensures that the function always returns a consistent value, even if the execution reaches the end without encountering any other return statements. Since the function already uses return True
as an explicit return, we will add a return None
at the end to make the implicit behavior explicit.
-
Copy modified line R256
@@ -255,3 +255,3 @@ | ||
self.retry(queue=QueueNames.RETRY, args=[{"Messages": updates}]) | ||
|
||
return None | ||
|
@statsd(namespace="tasks") | ||
def process_ses_results(self, response): # noqa: C901 | ||
def unbatched_process_ses_results(self, response): # noqa: C901 |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
To fix the issue, we will ensure that all code paths in the unbatched_process_ses_results
function have an explicit return statement. Specifically:
- Identify all paths where the function currently falls through without a return statement.
- Add
return None
explicitly at the end of the function or in any other paths where no return value is currently specified. - Ensure that the function's behavior remains unchanged while improving its readability and consistency.
-
Copy modified lines R376-R377
@@ -375 +375,3 @@ | ||
self.retry(queue=QueueNames.RETRY) | ||
|
||
return None |
Summary | Résumé
This PR turns
process_ses_results
into a wrapper so it can handle both batched and unbatched messages from the delivery receipts queue. This will allow us to hot swap theses_to_sqs_email_callbacks
lambda and TF infrastructure between batch saving and non-batch saving versions without dropping any notifications. It is essentially a round about way of feature flagging the batch saving work.Test instructions | Instructions pour tester la modification
TODO: Fill in test instructions for the reviewer.
Release Instructions | Instructions pour le déploiement
None.
Reviewer checklist | Liste de vérification du réviseur