From 2079cd641e9ebf9c73e2aaefd4bec246712e33eb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 1 Nov 2023 21:16:41 -0600 Subject: [PATCH] Fix post-merge compile errors --- crates/call2/src/room.rs | 21 ++++++++++---------- crates/live_kit_client2/examples/test_app.rs | 4 ++-- crates/live_kit_client2/src/test.rs | 6 +++--- crates/multi_buffer2/src/multi_buffer2.rs | 4 ++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/crates/call2/src/room.rs b/crates/call2/src/room.rs index ea4adf0385..deeec1df24 100644 --- a/crates/call2/src/room.rs +++ b/crates/call2/src/room.rs @@ -134,7 +134,7 @@ impl Room { } }); - let _maintain_video_tracks = cx.spawn_on_main({ + let _maintain_video_tracks = cx.spawn({ let room = room.clone(); move |this, mut cx| async move { let mut track_video_changes = room.remote_video_track_updates(); @@ -153,7 +153,7 @@ impl Room { } }); - let _maintain_audio_tracks = cx.spawn_on_main({ + let _maintain_audio_tracks = cx.spawn({ let room = room.clone(); |this, mut cx| async move { let mut track_audio_changes = room.remote_audio_track_updates(); @@ -1301,7 +1301,9 @@ impl Room { live_kit.room.unpublish_track(publication); } else { if muted { - cx.executor().spawn(publication.set_mute(muted)).detach(); + cx.background_executor() + .spawn(publication.set_mute(muted)) + .detach(); } live_kit.microphone_track = LocalTrack::Published { track_publication: publication, @@ -1344,7 +1346,7 @@ impl Room { return Task::ready(Err(anyhow!("live-kit was not initialized"))); }; - cx.spawn_on_main(move |this, mut cx| async move { + cx.spawn(move |this, mut cx| async move { let publish_track = async { let displays = displays.await?; let display = displays @@ -1387,7 +1389,9 @@ impl Room { live_kit.room.unpublish_track(publication); } else { if muted { - cx.executor().spawn(publication.set_mute(muted)).detach(); + cx.background_executor() + .spawn(publication.set_mute(muted)) + .detach(); } live_kit.screen_track = LocalTrack::Published { track_publication: publication, @@ -1454,14 +1458,11 @@ impl Room { .remote_audio_track_publications(&participant.user.id.to_string()) { let deafened = live_kit.deafened; - tasks.push( - cx.executor() - .spawn_on_main(move || track.set_enabled(!deafened)), - ); + tasks.push(cx.foreground_executor().spawn(track.set_enabled(!deafened))); } } - Ok(cx.executor().spawn_on_main(|| async { + Ok(cx.foreground_executor().spawn(async move { if let Some(mute_task) = mute_task { mute_task.await?; } diff --git a/crates/live_kit_client2/examples/test_app.rs b/crates/live_kit_client2/examples/test_app.rs index ad10a4c95d..4062441a06 100644 --- a/crates/live_kit_client2/examples/test_app.rs +++ b/crates/live_kit_client2/examples/test_app.rs @@ -42,7 +42,7 @@ fn main() { let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into()); let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap_or("secret".into()); - cx.spawn_on_main(|cx| async move { + cx.spawn(|cx| async move { let user_a_token = token::create( &live_kit_key, &live_kit_secret, @@ -104,7 +104,7 @@ fn main() { } println!("Pausing for 5 seconds to test audio, make some noise!"); - let timer = cx.executor().timer(Duration::from_secs(5)); + let timer = cx.background_executor().timer(Duration::from_secs(5)); timer.await; let remote_audio_track = room_b .remote_audio_tracks("test-participant-1") diff --git a/crates/live_kit_client2/src/test.rs b/crates/live_kit_client2/src/test.rs index f1c3d39b8e..10c97e8d81 100644 --- a/crates/live_kit_client2/src/test.rs +++ b/crates/live_kit_client2/src/test.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context, Result}; use async_trait::async_trait; use collections::{BTreeMap, HashMap}; use futures::Stream; -use gpui2::Executor; +use gpui2::BackgroundExecutor; use live_kit_server::token; use media::core_video::CVImageBuffer; use parking_lot::Mutex; @@ -16,7 +16,7 @@ pub struct TestServer { pub api_key: String, pub secret_key: String, rooms: Mutex>, - executor: Arc, + executor: Arc, } impl TestServer { @@ -24,7 +24,7 @@ impl TestServer { url: String, api_key: String, secret_key: String, - executor: Arc, + executor: Arc, ) -> Result> { let mut servers = SERVERS.lock(); if servers.contains_key(&url) { diff --git a/crates/multi_buffer2/src/multi_buffer2.rs b/crates/multi_buffer2/src/multi_buffer2.rs index c5827b8b13..b5a7ced517 100644 --- a/crates/multi_buffer2/src/multi_buffer2.rs +++ b/crates/multi_buffer2/src/multi_buffer2.rs @@ -878,7 +878,7 @@ impl MultiBuffer { cx.spawn(move |this, mut cx| async move { let mut excerpt_ranges = Vec::new(); let mut range_counts = Vec::new(); - cx.executor() + cx.background_executor() .scoped(|scope| { scope.spawn(async { let (ranges, counts) = @@ -4177,7 +4177,7 @@ mod tests { let guest_buffer = cx.build_model(|cx| { let state = host_buffer.read(cx).to_proto(); let ops = cx - .executor() + .background_executor() .block(host_buffer.read(cx).serialize_ops(None, cx)); let mut buffer = Buffer::from_proto(1, state, None).unwrap(); buffer