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

Lowering retry period for high priority emails to 25 seconds #2031

Merged
merged 28 commits into from
Dec 14, 2023

Conversation

jimleroyer
Copy link
Member

@jimleroyer jimleroyer commented Nov 20, 2023

Summary | Résumé

  • Lowering retry period for high priority emails
  • Refactored code for malware scan to be aligned with normal retry failures.

Test instructions | Instructions pour tester la modification

  • Executes unit tests.
  • Loads locally and send high priority emails, inject a manually raised exception in the provider_tasks.deliver_email function.

Release Instructions | Instructions pour le déploiement

No special instructions.

Reviewer checklist | Liste de vérification du réviseur

This is a suggested checklist of questions reviewers might ask during their
review | Voici une suggestion de liste de vérification comprenant des questions
que les réviseurs pourraient poser pendant leur examen :

  • Is the code maintainable? | Est-ce que le code peut être maintenu?
  • Have you tested it? | L’avez-vous testé?
  • Are there automated tests? | Y a-t-il des tests automatisés?
  • Does this cause automated test coverage to drop? | Est-ce que ça entraîne
    une baisse de la quantité de code couvert par les tests automatisés?
  • Does this break existing functionality? | Est-ce que ça brise une
    fonctionnalité existante?
  • Does this change the privacy policy? | Est-ce que ça entraîne une
    modification de la politique de confidentialité?
  • Does this introduce any security concerns? | Est-ce que ça introduit des
    préoccupations liées à la sécurité?
  • Does this significantly alter performance? | Est-ce que ça modifie de
    façon importante la performance?
  • What is the risk level of using added dependencies? | Quel est le degré de
    risque d’utiliser des dépendances ajoutées?
  • Should any documentation be updated as a result of this? (i.e. README
    setup, etc.) | Faudra-t-il mettre à jour la documentation à la suite de ce
    changement (fichier README, etc.)?

else:
countdown = None
try:
current_app.logger.warning(f"The exception is {repr(e)}")
Copy link
Member Author

Choose a reason for hiding this comment

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

Did we add this log warning in a specific context? This is not informative of the context. Nonetheless, I added the exception to the parameter while logging the exception down below.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was probably debugging code that slipped through

@jimleroyer jimleroyer marked this pull request as ready for review December 13, 2023 14:06
@@ -0,0 +1,43 @@
from typing import Any, Dict, Optional
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to move the parameters logic in its own module to avoid a circular import issue, as it was previously in a notifications init module. This would create issues.

@@ -6,11 +8,13 @@


def _check_and_queue_callback_task(notification):
if notification is None:
current_app.logger.warning("No notification provided, cannot queue callback task")
return
Copy link
Member Author

Choose a reason for hiding this comment

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

A bit more null protection, I think I added not part of the scope of these changes and while pairing with someone.

Copy link
Collaborator

@sastels sastels left a comment

Choose a reason for hiding this comment

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

Locally, added an exception and sent a high priority email, and it was retried 25 seconds later 👍

However, I cleared that and then sent a low priority email and it too was retried in 25 seconds 🤔

Copy link
Collaborator

@sastels sastels left a comment

Choose a reason for hiding this comment

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

My test had my artificial raise in the wrong place, basically. All good! :shipit:

@jimleroyer jimleroyer merged commit 68f2d3c into main Dec 14, 2023
4 checks passed
@jimleroyer jimleroyer deleted the feat/decrease-retry-for-email-high branch December 14, 2023 19:36
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