Skip to content
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

send emails using 3 new queues #1997

Merged
merged 7 commits into from
Oct 25, 2023
Merged

send emails using 3 new queues #1997

merged 7 commits into from
Oct 25, 2023

Conversation

sastels
Copy link
Collaborator

@sastels sastels commented Oct 6, 2023

Summary | Résumé

https://app.zenhub.com/workspaces/notify-planning-core-6411dfb7c95fb80014e0cab0/issues/gh/cds-snc/notification-planning-core/4

Move email sending (ie deliver_email()) to their own queues (send-email-high, send-email-medium, send-email-low)

note that these queues are still consumed by the same celery workers as the current email sending queues.

This PR is based on the analogous SMS work done in this PR.

Test instructions | Instructions pour tester la modification

  • Send some email
    • one-off, bulk
    • priority, normal, and bulk templates
  • see what delivery queues are being used by looking for lines in the celery logs like "... sent to the .... queue for delivery"
  • ensure the correct queue was used in each case

Release Instructions | Instructions pour le déploiement

@@ -0,0 +1,10 @@
#!/bin/sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_celery_core_tasks as an alternative name maybe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's less clunky!

(1, NORMAL, QueueNames.SEND_EMAIL_LOW), # autoswitch to bulk queue if bulk threshold is met.
(1_000, NORMAL, QueueNames.SEND_EMAIL_MEDIUM), # keep normal priority
(1, BULK, QueueNames.SEND_EMAIL_LOW), # keep bulk priority
(1_000, BULK, QueueNames.SEND_EMAIL_MEDIUM), # autoswitch to normal queue if normal threshold is met.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much better. 👏

@@ -1103,7 +1103,7 @@ def test_process_rows_works_without_key_type(
"to": "recip",
"row_number": "row_num",
"personalisation": {"foo": "bar"},
"queue": QueueNames.SEND_SMS_MEDIUM if template_type == SMS_TYPE else "send-{}-tasks".format(template_type),
"queue": QueueNames.SEND_SMS_MEDIUM if template_type == SMS_TYPE else QueueNames.SEND_EMAIL_MEDIUM,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that change trigger failures for SMS notification type test parameters? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the SMS ones are being set to QueueNames.SEND_SMS_MEDIUM as before. Previously the else really should have been just else "send-email-tasks" since there's no letter type in the test parameters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I read that change incorrectly, it's all orthogonal now and good

Copy link
Member

@jimleroyer jimleroyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good overall. I probably expected more tests to break and more changes. I left a question for one test output though where it seems either the test would fail or should fail.

Copy link
Member

@jimleroyer jimleroyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@sastels sastels merged commit e3ccb0c into main Oct 25, 2023
4 checks passed
@sastels sastels deleted the email-deliver-queues branch October 25, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants