From 5e3ded5b1be0308923dbed1cb82a7f287d6d4953 Mon Sep 17 00:00:00 2001 From: delishad21 Date: Sat, 9 Nov 2024 22:50:35 +0800 Subject: [PATCH 1/2] Update question-svc deployment and k8 files --- kubernetes/collab-service/collab-service-deployment.yaml | 6 +++--- .../matching-service/matching-service-deployment.yaml | 4 ++-- .../question-service/question-service-deployment.yaml | 4 ++-- kubernetes/user-service/user-service-deployment.yaml | 4 ++-- question-service/Dockerfile | 2 ++ question-service/package.json | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/kubernetes/collab-service/collab-service-deployment.yaml b/kubernetes/collab-service/collab-service-deployment.yaml index f846e1b39f..700f2757c2 100644 --- a/kubernetes/collab-service/collab-service-deployment.yaml +++ b/kubernetes/collab-service/collab-service-deployment.yaml @@ -30,6 +30,6 @@ spec: - secretRef: name: collab-secrets resources: - requests: - memory: "250Mi" - cpu: "100m" + limits: + memory: "1Gi" + cpu: "250m" diff --git a/kubernetes/matching-service/matching-service-deployment.yaml b/kubernetes/matching-service/matching-service-deployment.yaml index ea4ca01055..c3bb1bccb6 100644 --- a/kubernetes/matching-service/matching-service-deployment.yaml +++ b/kubernetes/matching-service/matching-service-deployment.yaml @@ -31,5 +31,5 @@ spec: name: matching-secrets resources: requests: - memory: "250Mi" - cpu: "100m" + memory: "1Gi" + cpu: "250m" diff --git a/kubernetes/question-service/question-service-deployment.yaml b/kubernetes/question-service/question-service-deployment.yaml index 85a0ec63fc..0c1a9e7bf8 100644 --- a/kubernetes/question-service/question-service-deployment.yaml +++ b/kubernetes/question-service/question-service-deployment.yaml @@ -31,5 +31,5 @@ spec: name: app-secrets resources: requests: - memory: "250Mi" - cpu: "100m" + memory: "1Gi" + cpu: "250m" diff --git a/kubernetes/user-service/user-service-deployment.yaml b/kubernetes/user-service/user-service-deployment.yaml index 8bbbcaa7c6..c3e6631513 100644 --- a/kubernetes/user-service/user-service-deployment.yaml +++ b/kubernetes/user-service/user-service-deployment.yaml @@ -31,5 +31,5 @@ spec: name: user-secrets resources: requests: - memory: "250Mi" - cpu: "100m" + memory: "1Gi" + cpu: "250m" diff --git a/question-service/Dockerfile b/question-service/Dockerfile index 6cc3ac9c29..35e340817d 100644 --- a/question-service/Dockerfile +++ b/question-service/Dockerfile @@ -10,4 +10,6 @@ COPY ./src ./src COPY ./tsconfig.json ./ +RUN npm run build + CMD ["npm", "start"] diff --git a/question-service/package.json b/question-service/package.json index dee7a2bdc0..65ba0147d3 100644 --- a/question-service/package.json +++ b/question-service/package.json @@ -5,7 +5,7 @@ "main": "dist/server.js", "scripts": { "build": "npx tsc", - "start": "ts-node src/server.ts", + "start": "node dist/server.js", "dev": "nodemon src/server.ts", "test": "echo \"Error: no test specified\" && exit 1" }, From e8b51827befcbcc56d84f2b93125248bd32584d9 Mon Sep 17 00:00:00 2001 From: jayllo-c Date: Sat, 9 Nov 2024 22:55:03 +0800 Subject: [PATCH 2/2] Update session-controller.ts update error message of details endpoint --- collaboration-service/src/controller/session-controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/collaboration-service/src/controller/session-controller.ts b/collaboration-service/src/controller/session-controller.ts index 4b9100acef..ec43dfbfe5 100644 --- a/collaboration-service/src/controller/session-controller.ts +++ b/collaboration-service/src/controller/session-controller.ts @@ -131,12 +131,16 @@ export const sessionController = { const { sessionId } = req.body; try { - const session = await Session.findOne({ session_id: sessionId, active: false }); + const session = await Session.findOne({ session_id: sessionId}); if (!session) { return res.status(404).json({ message: 'Session not found' }); } + if (session.active) { + return res.status(400).json({ message: 'Session is still ongoing' }); + } + const yDoc = new Y.Doc(); const yDocBuffer = session.yDoc;