core: judge count meter

This commit is contained in:
undefined committed 2021-10-16 16:51:59 +08:00
1 parent d8bfbb0a22
commit 130fbcc2dd
3 files changed
+17 -8

No files matched your search

-7
View File
@@ -1,5 +1,4 @@
import { ObjectID } from 'mongodb';
import tx2 from 'tx2';
import { JudgeResultBody, RecordDoc, TestCase } from '../interface';
import difficultyAlgorithm from '../lib/difficulty';
import { Logger } from '../logger';
@@ -20,11 +19,6 @@ import {
import { sleep } from '../utils';
const logger = new Logger('judge');
const judgeCount = tx2.meter({
name: 'judge/min',
samples: 60,
timeframe: 120,
});
export async function postJudge(rdoc: RecordDoc) {
if (typeof rdoc.input === 'string') return;
@@ -86,7 +80,6 @@ export async function next(body: JudgeResultBody) {
}
export async function end(body: JudgeResultBody) {
judgeCount.mark();
if (body.rid) body.rid = new ObjectID(body.rid);
let rdoc = await record.get(body.rid);
if (!rdoc) return;