From 5abaf3038fd91537ea75206419d1313942717ae6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 22 Dec 2024 21:13:22 +0000 Subject: [PATCH] fix: always remove child actors regardless of how they exit --- src/import/card.rs | 19 +++++++++---------- src/import/stack.rs | 7 +++---- src/import/stacks.rs | 7 +++---- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/import/card.rs b/src/import/card.rs index c1be96a..7caac23 100644 --- a/src/import/card.rs +++ b/src/import/card.rs @@ -129,17 +129,16 @@ impl Actor for ImportCardActor { }); on_actor_link_died!(this, actor_ref, id, reason, { + let label = this.labels_children.remove(&id); + let attachment = this.attachments_children.remove(&id); + tracing::debug!( + ?id, + ?label, + ?attachment, + "card (label|attachment) child stopped" + ); match reason { - ActorStopReason::Normal => { - let label = this.labels_children.remove(&id); - let attachment = this.attachments_children.remove(&id); - tracing::debug!( - ?id, - ?label, - ?attachment, - "card (label|attachment) child stopped" - ); - } + ActorStopReason::Normal => {} _ => { return Ok(Some(reason)); } diff --git a/src/import/stack.rs b/src/import/stack.rs index 34222fc..14daf47 100644 --- a/src/import/stack.rs +++ b/src/import/stack.rs @@ -85,11 +85,10 @@ impl Actor for ImportStackActor { }); on_actor_link_died!(this, actor_ref, id, reason, { + let stopped = this.children.remove(&id); + tracing::debug!(?id, ?stopped, "stack card child stopped"); match reason { - ActorStopReason::Normal => { - let stopped = this.children.remove(&id); - tracing::debug!(?id, ?stopped, "stack card child stopped"); - } + ActorStopReason::Normal => {} _ => { return Ok(Some(reason)); } diff --git a/src/import/stacks.rs b/src/import/stacks.rs index 0d917dd..79b53d0 100644 --- a/src/import/stacks.rs +++ b/src/import/stacks.rs @@ -139,11 +139,10 @@ impl Actor for ImportStacksActor { }); on_actor_link_died!(this, actor_ref, id, reason, { + let stopped = this.children.remove(&id); + tracing::debug!(?id, ?stopped, "stacks stack child stopped"); match reason { - ActorStopReason::Normal => { - let stopped = this.children.remove(&id); - tracing::debug!(?id, ?stopped, "stacks stack child stopped"); - } + ActorStopReason::Normal => {} _ => { return Ok(Some(reason)); }