mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core: judge: bug fix
This commit is contained in:
9 files changed
+20
-23
No files matched your search
@@ -25,8 +25,8 @@ const session = {
|
||||
getNext(t: Context) {
|
||||
return async (data: Partial<JudgeResultBody>) => {
|
||||
logger.debug('Next: %o', data);
|
||||
data.rid = t.rid as any;
|
||||
const rdoc = await RecordModel.get(new ObjectId(t.rid));
|
||||
data.rid = new ObjectId(t.rid);
|
||||
const rdoc = await RecordModel.get(data.rid);
|
||||
if (data.case) data.case.message ||= '';
|
||||
next({ ...data, domainId: rdoc.domainId });
|
||||
};
|
||||
@@ -34,8 +34,8 @@ const session = {
|
||||
getEnd(t: Context) {
|
||||
return async (data: Partial<JudgeResultBody>) => {
|
||||
data.key = 'end';
|
||||
data.rid = t.rid as any;
|
||||
const rdoc = await RecordModel.get(new ObjectId(t.rid));
|
||||
data.rid = new ObjectId(t.rid);
|
||||
const rdoc = await RecordModel.get(data.rid);
|
||||
logger.info('End: status=%d score=%d time=%dms memory=%dkb', data.status, data.score, data.time, data.memory);
|
||||
end({ ...data, domainId: rdoc.domainId });
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import path from 'path';
|
||||
import { ObjectId } from 'mongodb';
|
||||
import PQueue from 'p-queue';
|
||||
import superagent from 'superagent';
|
||||
import WebSocket from 'ws';
|
||||
@@ -150,8 +149,7 @@ export default class Hydro implements Session {
|
||||
return null;
|
||||
}
|
||||
|
||||
send(rid: string | ObjectId, key: 'next' | 'end', data: Partial<JudgeResultBody>) {
|
||||
data.rid = new ObjectId(rid);
|
||||
send(rid: string, key: 'next' | 'end', data: Partial<JudgeResultBody>) {
|
||||
data.key = key;
|
||||
if (data.case && typeof data.case.message === 'string') data.case.message = removeNixPath(data.case.message);
|
||||
if (typeof data.message === 'string') data.message = removeNixPath(data.message);
|
||||
|
||||
Reference in new issue
Block a user