Skip to content

Conversation

@Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Nov 16, 2024

At the moment we are using synchronous lettre transports for sending emails, which means that emails.send(...) needs to be wrapped in a spawn_blocking() call to not block the async tokio worker threads.

This PR migrates our Emails struct to use async transports underneath. It now offers an async_send() method, and (for now) a send() method that uses Handle::block_on() to be able to still send emails from blocking worker threads.

Unfortunately, some of our test code is currently still mixing sync and async code in interesting ways, which meant that some tests had to be slightly adjusted with spawn_blocking() calls to make them happy with the new implementation.

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Nov 16, 2024
@codecov
Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 93.41317% with 11 lines in your changes missing coverage. Please review.

Project coverage is 89.17%. Comparing base (64c1aa7) to head (410afc9).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/email.rs 81.25% 6 Missing ⚠️
src/worker/jobs/sync_admins.rs 57.14% 3 Missing ⚠️
src/controllers/user/resend.rs 92.85% 1 Missing ⚠️
src/tests/util/test_app.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9961      +/-   ##
==========================================
+ Coverage   89.16%   89.17%   +0.01%     
==========================================
  Files         292      292              
  Lines       30316    30380      +64     
==========================================
+ Hits        27031    27092      +61     
- Misses       3285     3288       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Turbo87 Turbo87 merged commit 2f4ed8a into rust-lang:main Nov 16, 2024
10 checks passed
@Turbo87 Turbo87 deleted the async-emails branch November 16, 2024 16:54
@Turbo87 Turbo87 mentioned this pull request Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant