core: check value exists

This commit is contained in:
undefined committed 2021-09-21 15:39:15 +08:00
1 parent 03c931ab47
commit cf4ef57f68
2 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.37.1",
"version": "2.37.2",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+6 -4
View File
@@ -160,11 +160,13 @@ bus.once('app/started', async () => {
{ ack: { $not: { $elemMatch: { $eq: id } } } },
{ $push: { ack: id } },
);
const payload = JSON.parse(res.value.payload);
if (process.send) process.send({ type: 'hydro:broadcast', data: { event: res.value.event, payload } });
if (res.value) bus.parallel(res.value.event, ...payload);
// eslint-disable-next-line no-await-in-loop
else await sleep(100);
if (!res.value) await sleep(100);
else {
const payload = JSON.parse(res.value.payload);
if (process.send) process.send({ type: 'hydro:broadcast', data: { event: res.value.event, payload } });
if (res.value) bus.parallel(res.value.event, ...payload);
}
}
})();
});