core: judge: bug fix

This commit is contained in:
undefined committed 2024-01-28 08:29:37 +08:00
1 parent 571522aefa
commit 314bba6a0e
9 files changed
+20 -23

No files matched your search

+4 -4
View File
@@ -1,6 +1,6 @@
/* eslint-disable no-await-in-loop */
import type {
Db, Filter, ObjectId, OnlyFieldsOfType,
import {
BSON, Db, Filter, ObjectId, OnlyFieldsOfType,
} from 'mongodb';
import pm2 from '@hydrooj/utils/lib/locate-pm2';
import type { ProblemSolutionHandler } from '../handler/problem';
@@ -111,10 +111,10 @@ try {
pm2.launchBus((err, bus) => {
if (err) throw new Error();
bus.on('hydro:broadcast', (packet) => {
(app.parallel as any)(packet.data.event, ...packet.data.payload);
(app.parallel as any)(packet.data.event, ...BSON.EJSON.parse(packet.data.payload));
});
app.on('bus/broadcast', (event, payload) => {
process.send({ type: 'hydro:broadcast', data: { event, payload } });
process.send({ type: 'hydro:broadcast', data: { event, payload: BSON.EJSON.stringify(payload) } });
});
console.debug('Using pm2 event bus');
});