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 e3b2d882dd
commit 3c4850ee72

View File

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