improve orchestrator, docker settings, and ui layouts

This commit is contained in:
Ishaan Dey
2024-05-12 22:06:11 -07:00
parent 18aca540cc
commit 59fb0521af
15 changed files with 264 additions and 128 deletions

View File

@ -435,15 +435,16 @@ io.on("connection", async (socket) => {
clearTimeout(inactivityTimeout)
};
if (sockets.length === 0) {
console.log("STARTING TIMER")
inactivityTimeout = setTimeout(() => {
io.fetchSockets().then(sockets => {
io.fetchSockets().then(async (sockets) => {
if (sockets.length === 0) {
// close server
console.log("Closing server due to inactivity.");
stopServer(data.sandboxId, data.userId)
// const res = await stopServer(data.sandboxId, data.userId)
}
});
}, 60000);
}, 20000);
}
})

View File

@ -198,7 +198,7 @@ ${code}`,
}
export const stopServer = async (sandboxId: string, userId: string) => {
await fetch("http://localhost:4001/stop", {
const res = await fetch("http://localhost:4001/stop", {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -208,4 +208,7 @@ export const stopServer = async (sandboxId: string, userId: string) => {
userId
}),
})
const data = await res.json()
return data
}