mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
升级queue为task
This commit is contained in:
1 parent
e7ce8c1f02
commit
5d7f57334f
14 files changed
+145
-130
No files matched your search
@@ -11,7 +11,6 @@ const {
|
||||
Route, Connection, Handler, ConnectionHandler,
|
||||
} = require('../service/server');
|
||||
const gridfs = require('../service/gridfs');
|
||||
const queue = require('../service/queue');
|
||||
const {
|
||||
NoProblemError, ProblemDataNotFoundError, BadRequestError,
|
||||
SolutionNotFoundError,
|
||||
@@ -25,8 +24,6 @@ const {
|
||||
PERM_REPLY_PROBLEM_SOLUTION, PERM_LOGGEDIN,
|
||||
} = require('../permission');
|
||||
|
||||
queue.assert('judge');
|
||||
|
||||
class ProblemHandler extends Handler {
|
||||
async _prepare() {
|
||||
this.checkPerm(PERM_VIEW_PROBLEM);
|
||||
@@ -122,7 +119,7 @@ class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
const rid = await record.add({
|
||||
uid: this.uid, lang, code, pid: this.pdoc._id,
|
||||
});
|
||||
await queue.push('judge', rid);
|
||||
await record.judge(rid);
|
||||
this.user.nSubmit++;
|
||||
this.response.body = { rid };
|
||||
this.response.redirect = `/r/${rid}`;
|
||||
@@ -135,7 +132,7 @@ class ProblemPretestHandler extends ProblemDetailHandler {
|
||||
const rid = await record.add({
|
||||
uid: this.uid, lang, code, pid: this.pdoc._id, input,
|
||||
});
|
||||
await queue.push('judge', rid);
|
||||
await record.judge(rid);
|
||||
this.response.body = { rid };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user