Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pegboard): automatically remove actor directory on cleanup #1651

Closed
Show file tree
Hide file tree
Changes from all 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: 1 addition & 0 deletions packages/infra/client/Cargo.lock

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

12 changes: 10 additions & 2 deletions packages/infra/client/manager/src/actor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,16 @@ impl Actor {
}

// Set exit code if it hasn't already been set
self.set_exit_code(ctx, None).await?;
let set_exit_code_res = self.set_exit_code(ctx, None).await;

self.cleanup_setup(ctx).await
// Cleanup setup
let cleanup_setup_res = self.cleanup_setup(ctx).await;

// Delete dir
let remove_actor_dir_res = self.remove_actor_dir(ctx).await;

// Chain results. Do this after running since we should attempt to run all steps if
// possible.
set_exit_code_res.and(cleanup_setup_res).and(remove_actor_dir_res)
}
}
8 changes: 8 additions & 0 deletions packages/infra/client/manager/src/actor/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,14 @@ impl Actor {
Ok(())
}

#[tracing::instrument(skip_all)]
pub async fn remove_actor_dir(&self, ctx: &Ctx) -> Result<()> {
let actor_path = ctx.actor_path(self.actor_id);
tokio::fs::remove_dir(&actor_path).await?;

Ok(())
}

// Path to the created namespace
fn netns_path(&self) -> PathBuf {
if let protocol::NetworkMode::Host = self.config.network_mode {
Expand Down
Loading