mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: remove rdoc in judge callback
This commit is contained in:
4 files changed
+19
-31
No files matched your search
@@ -28,7 +28,7 @@ const session = {
|
||||
data.rid = t.rid as any;
|
||||
const rdoc = await RecordModel.get(new ObjectId(t.rid));
|
||||
if (data.case) data.case.message ||= '';
|
||||
next({ ...data, rdoc });
|
||||
next({ ...data, domainId: rdoc.domainId });
|
||||
};
|
||||
},
|
||||
getEnd(t: Context) {
|
||||
@@ -37,7 +37,7 @@ const session = {
|
||||
data.rid = t.rid as any;
|
||||
const rdoc = await RecordModel.get(new ObjectId(t.rid));
|
||||
logger.info('End: status=%d score=%d time=%dms memory=%dkb', data.status, data.score, data.time, data.memory);
|
||||
end({ ...data, rdoc });
|
||||
end({ ...data, domainId: rdoc.domainId });
|
||||
};
|
||||
},
|
||||
getLang(lang: string, doThrow = true) {
|
||||
|
||||
@@ -166,6 +166,8 @@ export default class Hydro implements Session {
|
||||
if (performanceMode && data.case && !data.compilerText && !data.message) {
|
||||
t.callbackCache ||= [];
|
||||
t.callbackCache.push(data.case);
|
||||
// TODO use rate-limited send
|
||||
// FIXME handle fields like score, time, memory, etc
|
||||
} else {
|
||||
this.send(t.request.rid, 'next', data);
|
||||
}
|
||||
|
||||
@@ -57,5 +57,10 @@ export const judge = async (ctx: JudgeTask) => {
|
||||
}
|
||||
ctx.stat.done = new Date();
|
||||
if (process.env.DEV) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
ctx.end({ status });
|
||||
ctx.end({
|
||||
status,
|
||||
time: Math.floor(time * 1000000) / 1000000,
|
||||
memory,
|
||||
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user