From 57530c9d40193f79d15824290f647831458e15ee Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Thu, 24 Jan 2019 19:37:42 +0530 Subject: [PATCH 1/2] add "code" in callback to be consistent with failureReponseCallback --- src/routes/api/run.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/api/run.ts b/src/routes/api/run.ts index c07e82b..59685d4 100644 --- a/src/routes/api/run.ts +++ b/src/routes/api/run.ts @@ -73,7 +73,7 @@ const handleSuccessForSubmission = function (result: RunResponse) { }) // make the callback request - await axios.post(job.callback, {id: result.id, outputs: [url]}) + await axios.post(job.callback, {id: result.id, code: 200, outputs: [url]}) })() break; } @@ -136,6 +136,7 @@ const getRunPoolElement = function (body: RunRequestBody, res: Response): RunPoo * HTTP/1.1 200 OK * { * "id": 10, + * "code": 200, * "outputs": ["http://localhost/judge-submissions/file.json"] * } */ From 3f946087dbe3f8327505c1c3cf2e9e69d2b6bf45 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Mon, 28 Jan 2019 12:50:34 +0530 Subject: [PATCH 2/2] keep callback response consistent --- src/routes/api/run.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/api/run.ts b/src/routes/api/run.ts index 59685d4..0d12365 100644 --- a/src/routes/api/run.ts +++ b/src/routes/api/run.ts @@ -61,6 +61,7 @@ const handleSuccessForSubmission = function (result: RunResponse) { // send a post request to callback (async () => { // 1. upload the result to s3 and get the url + const code = result.stderr ? 400 : 200 const {url} = await upload(result) // 2. save the url in db @@ -73,7 +74,7 @@ const handleSuccessForSubmission = function (result: RunResponse) { }) // make the callback request - await axios.post(job.callback, {id: result.id, code: 200, outputs: [url]}) + await axios.post(job.callback, {id: result.id, code, outputs: [url]}) })() break; }