Skip to content

Commit

Permalink
fix: call on_panic when actor panics during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
tqwewe committed Aug 14, 2024
1 parent d7c8d7c commit 8e46e34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kameo/src/actor/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ async fn run_actor_lifecycle<A, S>(

if let Err(err) = start_res {
let reason = ActorStopReason::Panicked(err);
let mut state = S::new_from_actor(actor, actor_ref.clone());
state.on_shutdown(reason.clone()).await.unwrap();
let actor = state.shutdown().await;
actor
.on_stop(actor_ref.clone(), reason.clone())
.await
Expand Down

0 comments on commit 8e46e34

Please sign in to comment.