Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion plugins/listener/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ hound = { workspace = true }
vorbis_rs = { workspace = true }

ractor = { workspace = true }
ractor-supervisor = { workspace = true }

futures-util = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
Expand Down
21 changes: 14 additions & 7 deletions plugins/listener/src/actors/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ use tauri_plugin_settings::SettingsPluginExt;
use tauri_specta::Event;
use tracing::Instrument;

use crate::DegradedError;
use crate::SessionLifecycleEvent;
use crate::actors::session::lifecycle::{
clear_sentry_session_context, configure_sentry_session_context, emit_session_ended,
stop_actor_by_name_and_wait,
};
use crate::actors::{SessionContext, SessionParams, session_span, spawn_session_supervisor};
use crate::actors::{
SessionContext, SessionMsg, SessionParams, session_span, spawn_session_supervisor,
};

pub enum RootMsg {
StartSession(SessionParams, RpcReplyPort<bool>),
Expand Down Expand Up @@ -103,7 +105,13 @@ impl Actor for RootActor {
tracing::info!(?reason, "session_supervisor_terminated");
state.supervisor = None;
state.finalizing = false;
emit_session_ended(&state.app, &session_id, None);

let failure_reason = reason.and_then(|r| {
serde_json::from_str::<DegradedError>(&r)
.ok()
.map(|d| format!("{:?}", d))
});
emit_session_ended(&state.app, &session_id, failure_reason);
}
}
SupervisionEvent::ActorFailed(cell, error) => {
Expand Down Expand Up @@ -171,6 +179,7 @@ async fn start_session_impl(

if let Err(error) = (SessionLifecycleEvent::Active {
session_id: params.session_id,
error: None,
})
.emit(&state.app)
{
Expand Down Expand Up @@ -212,9 +221,7 @@ async fn stop_session_impl(state: &mut RootState) {
}
}

// TO make sure post_stop is called.
stop_actor_by_name_and_wait(crate::actors::RecorderActor::name(), "session_stop").await;

supervisor.stop(None);
let session_ref: ActorRef<SessionMsg> = supervisor.clone().into();
let _ = session_ref.cast(SessionMsg::Shutdown);
}
}
Loading
Loading