mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
remove .wait() from finish_attach
While debugging on windows earlier today I saw that we were blocked on this wait on the main thread. For whatever reason, that only blocks in practice on Windows; I suspect that this is due to a timing issue on windows where the server side takes longer to respond than it does on posix.
This commit is contained in:
parent
4442e8030d
commit
101aedd6a5
@ -6,7 +6,7 @@ use crate::mux::tab::{Tab, TabId};
|
||||
use crate::mux::window::WindowId;
|
||||
use crate::mux::Mux;
|
||||
use crate::server::client::Client;
|
||||
use crate::server::codec::{GetCodecVersion, Spawn, CODEC_VERSION};
|
||||
use crate::server::codec::{GetCodecVersion, ListTabsResponse, Spawn, CODEC_VERSION};
|
||||
use crate::server::tab::ClientTab;
|
||||
use anyhow::{anyhow, bail};
|
||||
use portable_pty::{CommandBuilder, PtySize};
|
||||
@ -146,7 +146,11 @@ impl ClientDomain {
|
||||
None
|
||||
}
|
||||
|
||||
fn finish_attach(domain_id: DomainId, client: Client) -> anyhow::Result<()> {
|
||||
fn finish_attach(
|
||||
domain_id: DomainId,
|
||||
client: Client,
|
||||
tabs: ListTabsResponse,
|
||||
) -> anyhow::Result<()> {
|
||||
let mux = Mux::get().unwrap();
|
||||
let domain = mux
|
||||
.get_domain(domain_id)
|
||||
@ -158,7 +162,6 @@ impl ClientDomain {
|
||||
let inner = Arc::new(ClientInner::new(domain_id, client));
|
||||
*domain.inner.borrow_mut() = Some(Arc::clone(&inner));
|
||||
|
||||
let tabs = inner.client.list_tabs().wait()?;
|
||||
log::debug!("ListTabs result {:#?}", tabs);
|
||||
|
||||
for entry in tabs.tabs.iter() {
|
||||
@ -296,8 +299,16 @@ impl Domain for ClientDomain {
|
||||
}
|
||||
};
|
||||
|
||||
let tabs = match client.list_tabs().wait() {
|
||||
Ok(tabs) => tabs,
|
||||
Err(err) => {
|
||||
promise.result(Err(err));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
Future::with_executor(executor(), move || {
|
||||
promise.result(ClientDomain::finish_attach(domain_id, client));
|
||||
promise.result(ClientDomain::finish_attach(domain_id, client, tabs));
|
||||
drop(activity);
|
||||
Ok(())
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user