-
Notifications
You must be signed in to change notification settings - Fork 610
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
crates_io_worker: Replace r2d2
with deadpool
#8424
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8424 +/- ##
==========================================
- Coverage 87.62% 87.61% -0.01%
==========================================
Files 272 272
Lines 26321 26303 -18
==========================================
- Hits 23064 23046 -18
Misses 3257 3257 ☔ View full report in Codecov by Sentry. |
This comment was marked as outdated.
This comment was marked as outdated.
With the background worker ported to `deadpool` it requires one extra connection, so setting it to two connections by default isn't sufficient anymore.
pub async fn spawn_blocking<F, R, E>(f: F) -> Result<R, E> | ||
where | ||
F: FnOnce() -> Result<R, E> + Send + 'static, | ||
R: Send + 'static, | ||
E: Send + From<JoinError> + 'static, | ||
{ | ||
let current_span = tracing::Span::current(); | ||
let hub = Hub::current(); | ||
tokio::task::spawn_blocking(move || current_span.in_scope(|| Hub::run(hub, f))) | ||
.await | ||
// Convert `JoinError` to `E` | ||
.map_err(Into::into) | ||
// Flatten `Result<Result<_, E>, E>` to `Result<_, E>` | ||
.and_then(std::convert::identity) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it wrong that I'm actually most excited by this change?
While #8385 ported the individual background worker jobs from
r2d2
todeadpool
, this PR ports the background worker system itself to it.Note that the default
async_pool_size
for the test suite had to be increased because the background worker system now requires us to have one more connection available.