From acbbb91bbf2be62ec77084f63e4422a8fe803852 Mon Sep 17 00:00:00 2001 From: HermanL02 Date: Thu, 1 May 2025 15:29:19 -0300 Subject: [PATCH] fix: work arounds with the round number checks --- worker/src/task/5-routes.ts | 11 +++++++---- worker/src/utils/constant.ts | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/worker/src/task/5-routes.ts b/worker/src/task/5-routes.ts index 7c42558..70eba8a 100644 --- a/worker/src/task/5-routes.ts +++ b/worker/src/task/5-routes.ts @@ -59,14 +59,16 @@ export async function routes() { const signature = req.body.signature; const prUrl = req.body.prUrl; // Modified round number not fetch from the input instead fetch from the namespace - const roundNumber = await namespaceWrapper.getRound(); + const roundNumber = req.body.roundNumber; const success = req.body.success; const message = req.body.message; console.log("[TASK] req.body", req.body); try { if (!success){ // TODO: Need to call the server to cancel the task - await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED); + // await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED); + // It cannot be round number based, becasue the current round might already missed the submission window + // await namespaceWrapper.storeSet(`result-${roundNumber}`, status.ISSUE_SUMMARIZATION_FAILED); console.error("[TASK] Error summarizing repository:", message); return; } @@ -137,11 +139,12 @@ export async function routes() { if (middleServerResponse.status !== 200) { throw new Error(`Posting to middle server failed: ${middleServerResponse.statusText}`); } - await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_SUCCEEDED); + await namespaceWrapper.storeSet(`shouldMakeSubmission`, "true"); + await namespaceWrapper.storeSet(`submissionRoundNumber`, roundNumber.toString()); res.status(200).json({ result: "Successfully saved PR" }); } catch (error) { console.error("[TASK] Error adding PR to summarizer todo:", error); - await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_FAILED); + // await namespaceWrapper.storeSet(`result-${roundNumber}`, status.SAVING_TODO_PR_FAILED); res.status(400).json({ error: "Failed to save PR" }); } }); diff --git a/worker/src/utils/constant.ts b/worker/src/utils/constant.ts index 0fd0c69..bda5c7f 100644 --- a/worker/src/utils/constant.ts +++ b/worker/src/utils/constant.ts @@ -17,6 +17,7 @@ export const status = { SAVING_TODO_PR_FAILED: "Summarizer todo PR not saved", SAVING_TODO_PR_SUCCEEDED: "Summarizer todo PR saved", NOT_FINISHED_TASK: "Not finished task", + NO_SUBMISSION_BUT_SUBMISSION_CALLED: "No submission but submission called", }; export const errorMessage = {