Skip to content

Commit

Permalink
send delete event while initial process deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
mingfukuang committed Jul 30, 2024
1 parent 369a73f commit 59463fb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions crates/runc-shim/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,21 @@ where
let exec_id_opt = req.exec_id().as_option();
let (pid, exit_status, exited_at) = container.delete(exec_id_opt).await?;
self.factory.cleanup(&self.namespace, container).await?;

let ts = convert_to_timestamp(exited_at);
// if we deleted an init task, send the task delete event
if req.exec_id().is_empty() {
containers.remove(req.id());
self.send_event(TaskDelete {
container_id: id,
pid: pid as u32,
exit_status: exit_status as u32,
exited_at: Some(ts.clone()).into(),
..Default::default()
})
.await;
}

let ts = convert_to_timestamp(exited_at);
self.send_event(TaskDelete {
container_id: id,
pid: pid as u32,
exit_status: exit_status as u32,
exited_at: Some(ts.clone()).into(),
..Default::default()
})
.await;

let mut resp = DeleteResponse::new();
resp.set_exited_at(ts);
resp.set_pid(pid as u32);
Expand Down

0 comments on commit 59463fb

Please sign in to comment.