Skip to content

Commit

Permalink
Merge pull request #34 from farhan787/issue-#24
Browse files Browse the repository at this point in the history
runpool entity deleted
  • Loading branch information
abhishek97 authored May 17, 2019
2 parents b4b108f + 8ee3fa6 commit 02977aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/routes/api/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const handleTimeoutForSubmission = function (submissionId: number) {
case 'callback':
axios.post(job.callback, errorResponse)
}

delete runPool[submissionId]
}

const handleSuccessForSubmission = function (result: RunResponse) {
Expand Down Expand Up @@ -79,6 +81,8 @@ const handleSuccessForSubmission = function (result: RunResponse) {
})()
break;
}

delete runPool[result.id]
}

/**
Expand Down Expand Up @@ -172,7 +176,6 @@ route.post('/', (req, res, next) => {
setTimeout(() => {
if (runPool[submission.id]) {
handleTimeoutForSubmission(submission.id)
delete runPool[submission.id]
}
}, config.RUN.TIMEOUT)

Expand All @@ -198,7 +201,6 @@ route.post('/', (req, res, next) => {
successListener.on('success', (result: RunResponse) => {
if (runPool[result.id]) {
handleSuccessForSubmission(result)
delete runPool[result.id]
}
Submissions.update(<any>{
end_time: new Date()
Expand Down

0 comments on commit 02977aa

Please sign in to comment.