Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces asynchronous, background-safe email sending for Slack invites and reminder mails, with real-time progress tracking and improved logging. The main goal is to prevent request timeouts and provide clients with immediate feedback while email jobs run in the background. It also adds endpoints to monitor the progress of these background jobs and enhances logging for mail operations.
The most important changes are:
Background email sending and progress tracking:
router_v1.py, allowing these emails to be sent asynchronously and immediately returning a response to the client. Also added a new endpoint to check send progress for a given event. [1] [2]EventServicewith thread-safe methods to start, increment, and finish email sending jobs, and a method to retrieve progress (including estimated time remaining).send_slack_mail_backgroundandsend_reminder_mails_backgroundmethods inEventServicethat create independent DB sessions for safe background execution, send emails with optional throttling delay, and update progress tracking. [1] [2]API and logic improvements:
Logging improvements:
MailClientfor mail creation and sending, improving observability and debugging. [1] [2] [3] [4]