fix: filecontent update while switching tabs, empty file crash

This commit is contained in:
Akhileshrangani4
2024-09-28 19:25:03 -04:00
parent 6845e1fef9
commit 5817b2ea48
2 changed files with 152 additions and 98 deletions

View File

@ -159,8 +159,9 @@ io.on("connection", async (socket) => {
await lockManager.acquireLock(data.sandboxId, async () => {
try {
if (!containers[data.sandboxId]) {
containers[data.sandboxId] = await Sandbox.create({ timeoutMs: 1200000 });
// Start a new container if the container doesn't exist or it timed out.
if (!containers[data.sandboxId] || !(await containers[data.sandboxId].isRunning())) {
containers[data.sandboxId] = await Sandbox.create({ timeoutMs: 1200_000 });
console.log("Created container ", data.sandboxId);
}
} catch (e: any) {