Restore HTTP client transition, but use reqwest everywhere (#19055)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-10-11 14:58:58 -07:00 committed by GitHub
parent c709b66f35
commit 22ac178f9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 838 additions and 418 deletions

View file

@ -9,14 +9,14 @@ use thread_local::ThreadLocal;
/// Note: this locks on the cloneable sender, but its done once per thread, so it
/// shouldn't result in too much contention
pub struct UnboundedSyncSender<T: Send> {
clonable_sender: Mutex<Sender<T>>,
cloneable_sender: Mutex<Sender<T>>,
local_senders: ThreadLocal<Sender<T>>,
}
impl<T: Send> UnboundedSyncSender<T> {
pub fn new(sender: Sender<T>) -> Self {
Self {
clonable_sender: Mutex::new(sender),
cloneable_sender: Mutex::new(sender),
local_senders: ThreadLocal::new(),
}
}
@ -27,6 +27,6 @@ impl<T: Send> Deref for UnboundedSyncSender<T> {
fn deref(&self) -> &Self::Target {
self.local_senders
.get_or(|| self.clonable_sender.lock().clone())
.get_or(|| self.cloneable_sender.lock().clone())
}
}