WIP: change over background executor test helpers

This commit is contained in:
Mikayla 2023-11-06 10:16:08 -08:00
parent 123439adc2
commit d66ed4310f
No known key found for this signature in database
4 changed files with 3 additions and 25 deletions

View file

@ -36,12 +36,4 @@ impl Executor {
}
}
}
pub fn record_backtrace(&self) {
match self {
Executor::Production => {}
#[cfg(test)]
Executor::Deterministic(background) => background.record_backtrace(),
}
}
}

View file

@ -110,7 +110,7 @@ struct Session {
peer: Arc<Peer>,
connection_pool: Arc<parking_lot::Mutex<ConnectionPool>>,
live_kit_client: Option<Arc<dyn live_kit_server::api::Client>>,
executor: Executor,
_executor: Executor,
}
impl Session {
@ -612,7 +612,7 @@ impl Server {
peer: this.peer.clone(),
connection_pool: this.connection_pool.clone(),
live_kit_client: this.app_state.live_kit_client.clone(),
executor: executor.clone(),
_executor: executor.clone()
};
update_user_contacts(user_id, &session).await?;
@ -1723,7 +1723,6 @@ async fn update_language_server(
request: proto::UpdateLanguageServer,
session: Session,
) -> Result<()> {
session.executor.record_backtrace();
let project_id = ProjectId::from_proto(request.project_id);
let project_connection_ids = session
.db()
@ -1750,7 +1749,6 @@ async fn forward_project_request<T>(
where
T: EntityMessage + RequestMessage,
{
session.executor.record_backtrace();
let project_id = ProjectId::from_proto(request.remote_entity_id());
let host_connection_id = {
let collaborators = session
@ -1778,7 +1776,6 @@ async fn create_buffer_for_peer(
request: proto::CreateBufferForPeer,
session: Session,
) -> Result<()> {
session.executor.record_backtrace();
let peer_id = request.peer_id.ok_or_else(|| anyhow!("invalid peer id"))?;
session
.peer
@ -1791,7 +1788,6 @@ async fn update_buffer(
response: Response<proto::UpdateBuffer>,
session: Session,
) -> Result<()> {
session.executor.record_backtrace();
let project_id = ProjectId::from_proto(request.project_id);
let mut guest_connection_ids;
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"))?;
session.executor.record_backtrace();
broadcast(
Some(session.connection_id),
guest_connection_ids,

View file

@ -222,11 +222,6 @@ impl BackgroundExecutor {
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"))]
pub fn rng(&self) -> StdRng {
self.dispatcher.as_test().unwrap().rng()

View file

@ -128,12 +128,8 @@ impl TestDispatcher {
})
}
pub fn record_backtrace(&self) {
todo!("record_backtrace")
}
pub fn rng(&self) -> StdRng {
todo!("rng")
self.state.lock().random.clone()
}
}