small changes
This commit is contained in:
parent
bf35c2bf82
commit
a3dd0d6598
@ -5,6 +5,8 @@ import { currentUser } from "@clerk/nextjs";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import Editor from "@/components/editor";
|
||||
|
||||
export const revalidate = 0;
|
||||
|
||||
const getUserData = async (id: string) => {
|
||||
const userRes = await fetch(
|
||||
`https://database.ishaan1013.workers.dev/api/user?id=${id}`
|
||||
|
@ -3,7 +3,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import monaco from "monaco-editor";
|
||||
import Editor, { BeforeMount, OnMount } from "@monaco-editor/react";
|
||||
import { Socket, io } from "socket.io-client";
|
||||
import { io } from "socket.io-client";
|
||||
import { toast } from "sonner";
|
||||
import { useClerk } from "@clerk/nextjs";
|
||||
|
||||
@ -40,8 +40,11 @@ export default function CodeEditor({
|
||||
sandboxData: Sandbox;
|
||||
}) {
|
||||
const socket = io(
|
||||
`ws://${sandboxData.id}.ws.ishaand.com?userId=${userData.id}&sandboxId=${sandboxData.id}`
|
||||
// `http://localhost:4000?userId=${userData.id}&sandboxId=${sandboxData.id}`
|
||||
// `ws://${sandboxData.id}.ws.ishaand.com?userId=${userData.id}&sandboxId=${sandboxData.id}`
|
||||
`http://localhost:4000?userId=${userData.id}&sandboxId=${sandboxData.id}`,
|
||||
{
|
||||
timeout: 2000,
|
||||
}
|
||||
);
|
||||
|
||||
const [isAwaitingConnection, setIsAwaitingConnection] = useState(true);
|
||||
@ -695,6 +698,7 @@ export default function CodeEditor({
|
||||
}
|
||||
}}
|
||||
options={{
|
||||
tabSize: 2,
|
||||
minimap: {
|
||||
enabled: false,
|
||||
},
|
||||
|
@ -2,6 +2,8 @@ import { type ClassValue, clsx } from "clsx";
|
||||
// import { toast } from "sonner"
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import { Sandbox, TFile, TFolder } from "./types";
|
||||
import ecsClient from "./ecs";
|
||||
import { DescribeServicesCommand } from "@aws-sdk/client-ecs";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
@ -91,3 +93,32 @@ export function addNew(
|
||||
// callback(false);
|
||||
// }
|
||||
// }
|
||||
|
||||
// const checkServiceStatus = (serviceName: string) => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
|
||||
// const command = new DescribeServicesCommand({
|
||||
// cluster: "arn:aws:ecs:us-east-1:767398085538:service/Sandbox/Sandbox",
|
||||
// services: [serviceName]
|
||||
// })
|
||||
|
||||
// const interval = setInterval(async () => {
|
||||
// try {
|
||||
|
||||
// const response = await ecsClient.send(command)
|
||||
|
||||
// if (response.services && response.services.length > 0) {
|
||||
// const service = response.services?.[0];
|
||||
// if (service.runningCount === service.desiredCount && service.deployments.length === 1 && service.deployments[0].rolloutState === 'COMPLETED') {
|
||||
// clearInterval(interval);
|
||||
// resolve(service);
|
||||
// }
|
||||
// }
|
||||
|
||||
// } catch (error) {
|
||||
// clearInterval(interval);
|
||||
// reject(error);
|
||||
// }
|
||||
// }, 5000); // Check every 5 seconds
|
||||
// });
|
||||
// };
|
||||
|
Loading…
x
Reference in New Issue
Block a user