fix: recreate timed out E2B sandboxes on page load
This commit is contained in:
parent
023b3bdc5e
commit
8e3a6d1aa6
@ -176,8 +176,9 @@ io.on("connection", async (socket) => {
|
|||||||
|
|
||||||
const createdContainer = await lockManager.acquireLock(data.sandboxId, async () => {
|
const createdContainer = await lockManager.acquireLock(data.sandboxId, async () => {
|
||||||
try {
|
try {
|
||||||
if (!containers[data.sandboxId]) {
|
// Start a new container if the container doesn't exist or it timed out.
|
||||||
containers[data.sandboxId] = await Sandbox.create({ timeoutMs: 1200000 });
|
if (!containers[data.sandboxId] || !(await containers[data.sandboxId].isRunning())) {
|
||||||
|
containers[data.sandboxId] = await Sandbox.create({ timeoutMs: 1200_000 });
|
||||||
console.log("Created container ", data.sandboxId);
|
console.log("Created container ", data.sandboxId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user