fix: wait until terminals are killed to close the container

This commit is contained in:
James Murdza 2024-06-14 12:28:19 -04:00
parent a0fb905a04
commit 7353e88567

View File

@ -432,11 +432,12 @@ io.on("connection", async (socket) => {
socket.on("disconnect", async () => { socket.on("disconnect", async () => {
if (data.isOwner) { if (data.isOwner) {
Object.entries(terminals).forEach((t) => { await Promise.all(
const terminal = t[1]; Object.entries(terminals).map(async ([key, terminal]) => {
terminal.kill(); await terminal.kill();
delete terminals[t[0]]; delete terminals[key];
}); })
);
await lockManager.acquireLock(data.sandboxId, async () => { await lockManager.acquireLock(data.sandboxId, async () => {
try { try {