improve orchestrator, docker settings, and ui layouts
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -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
|
||||
}
|
Reference in New Issue
Block a user