mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
WIP: change over background executor test helpers
This commit is contained in:
parent
123439adc2
commit
d66ed4310f
4 changed files with 3 additions and 25 deletions
|
@ -36,12 +36,4 @@ impl Executor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_backtrace(&self) {
|
|
||||||
match self {
|
|
||||||
Executor::Production => {}
|
|
||||||
#[cfg(test)]
|
|
||||||
Executor::Deterministic(background) => background.record_backtrace(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ struct Session {
|
||||||
peer: Arc<Peer>,
|
peer: Arc<Peer>,
|
||||||
connection_pool: Arc<parking_lot::Mutex<ConnectionPool>>,
|
connection_pool: Arc<parking_lot::Mutex<ConnectionPool>>,
|
||||||
live_kit_client: Option<Arc<dyn live_kit_server::api::Client>>,
|
live_kit_client: Option<Arc<dyn live_kit_server::api::Client>>,
|
||||||
executor: Executor,
|
_executor: Executor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Session {
|
impl Session {
|
||||||
|
@ -612,7 +612,7 @@ impl Server {
|
||||||
peer: this.peer.clone(),
|
peer: this.peer.clone(),
|
||||||
connection_pool: this.connection_pool.clone(),
|
connection_pool: this.connection_pool.clone(),
|
||||||
live_kit_client: this.app_state.live_kit_client.clone(),
|
live_kit_client: this.app_state.live_kit_client.clone(),
|
||||||
executor: executor.clone(),
|
_executor: executor.clone()
|
||||||
};
|
};
|
||||||
update_user_contacts(user_id, &session).await?;
|
update_user_contacts(user_id, &session).await?;
|
||||||
|
|
||||||
|
@ -1723,7 +1723,6 @@ async fn update_language_server(
|
||||||
request: proto::UpdateLanguageServer,
|
request: proto::UpdateLanguageServer,
|
||||||
session: Session,
|
session: Session,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
session.executor.record_backtrace();
|
|
||||||
let project_id = ProjectId::from_proto(request.project_id);
|
let project_id = ProjectId::from_proto(request.project_id);
|
||||||
let project_connection_ids = session
|
let project_connection_ids = session
|
||||||
.db()
|
.db()
|
||||||
|
@ -1750,7 +1749,6 @@ async fn forward_project_request<T>(
|
||||||
where
|
where
|
||||||
T: EntityMessage + RequestMessage,
|
T: EntityMessage + RequestMessage,
|
||||||
{
|
{
|
||||||
session.executor.record_backtrace();
|
|
||||||
let project_id = ProjectId::from_proto(request.remote_entity_id());
|
let project_id = ProjectId::from_proto(request.remote_entity_id());
|
||||||
let host_connection_id = {
|
let host_connection_id = {
|
||||||
let collaborators = session
|
let collaborators = session
|
||||||
|
@ -1778,7 +1776,6 @@ async fn create_buffer_for_peer(
|
||||||
request: proto::CreateBufferForPeer,
|
request: proto::CreateBufferForPeer,
|
||||||
session: Session,
|
session: Session,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
session.executor.record_backtrace();
|
|
||||||
let peer_id = request.peer_id.ok_or_else(|| anyhow!("invalid peer id"))?;
|
let peer_id = request.peer_id.ok_or_else(|| anyhow!("invalid peer id"))?;
|
||||||
session
|
session
|
||||||
.peer
|
.peer
|
||||||
|
@ -1791,7 +1788,6 @@ async fn update_buffer(
|
||||||
response: Response<proto::UpdateBuffer>,
|
response: Response<proto::UpdateBuffer>,
|
||||||
session: Session,
|
session: Session,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
session.executor.record_backtrace();
|
|
||||||
let project_id = ProjectId::from_proto(request.project_id);
|
let project_id = ProjectId::from_proto(request.project_id);
|
||||||
let mut guest_connection_ids;
|
let mut guest_connection_ids;
|
||||||
let mut host_connection_id = None;
|
let mut host_connection_id = None;
|
||||||
|
@ -1812,7 +1808,6 @@ async fn update_buffer(
|
||||||
}
|
}
|
||||||
let host_connection_id = host_connection_id.ok_or_else(|| anyhow!("host not found"))?;
|
let host_connection_id = host_connection_id.ok_or_else(|| anyhow!("host not found"))?;
|
||||||
|
|
||||||
session.executor.record_backtrace();
|
|
||||||
broadcast(
|
broadcast(
|
||||||
Some(session.connection_id),
|
Some(session.connection_id),
|
||||||
guest_connection_ids,
|
guest_connection_ids,
|
||||||
|
|
|
@ -222,11 +222,6 @@ impl BackgroundExecutor {
|
||||||
self.dispatcher.as_test().unwrap().allow_parking();
|
self.dispatcher.as_test().unwrap().allow_parking();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
|
||||||
pub fn record_backtrace(&self) {
|
|
||||||
self.dispatcher.as_test().unwrap().record_backtrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub fn rng(&self) -> StdRng {
|
pub fn rng(&self) -> StdRng {
|
||||||
self.dispatcher.as_test().unwrap().rng()
|
self.dispatcher.as_test().unwrap().rng()
|
||||||
|
|
|
@ -128,12 +128,8 @@ impl TestDispatcher {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_backtrace(&self) {
|
|
||||||
todo!("record_backtrace")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn rng(&self) -> StdRng {
|
pub fn rng(&self) -> StdRng {
|
||||||
todo!("rng")
|
self.state.lock().random.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue