mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: enhanced pm2 detection
This commit is contained in:
1 parent
0562661fb4
commit
2f2b1ca711
5 files changed
+24
-9
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { hostname } from 'os';
|
||||
import moment from 'moment-timezone';
|
||||
import { FilterQuery, ObjectID } from 'mongodb';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { sleep } from '@hydrooj/utils/lib/utils';
|
||||
import { BaseService, EventDoc, Task } from '../interface';
|
||||
import { Logger } from '../logger';
|
||||
@@ -139,7 +140,7 @@ class TaskModel {
|
||||
static Worker = Worker;
|
||||
}
|
||||
|
||||
const id = hostname();
|
||||
const id = process.env.exec_mode === 'cluster_mode' ? hostname() : nanoid();
|
||||
Worker.addHandler('task.daily', async () => {
|
||||
await global.Hydro.model.record.coll.deleteMany({ contest: new ObjectID('000000000000000000000000') });
|
||||
await global.Hydro.script.rp?.run({}, new Logger('task/rp').debug);
|
||||
|
||||
Reference in new issue
Block a user