Restore HTTP client transition, but use reqwest everywhere (#19055)
Release Notes: - N/A
This commit is contained in:
parent
c709b66f35
commit
22ac178f9d
35 changed files with 838 additions and 418 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue