5122: Yield the BBQueue writing loop r=ManyTheFish a=Kerollmops

We prefer yielding to let the writing thread do its job instead of spin looping.

Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
meili-bors[bot] 2024-12-04 13:33:51 +00:00 committed by GitHub
commit 3ded069042
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -661,6 +661,11 @@ where
if sender.is_disconnected() {
return Err(Error::InternalError(InternalError::AbortedIndexation));
}
// We prefer to yield and allow the writing thread
// to do its job, especially beneficial when there
// is only one CPU core available.
std::thread::yield_now();
}
}