mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: add disableWorker option
This commit is contained in:
1 file changed
+5
-1
@@ -1,3 +1,4 @@
|
||||
import cac from 'cac';
|
||||
import moment from 'moment-timezone';
|
||||
import { sleep } from '@hydrooj/utils';
|
||||
import { Context, Service } from '../context';
|
||||
@@ -9,6 +10,8 @@ declare module '../context' {
|
||||
}
|
||||
}
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
export default class WorkerService extends Service {
|
||||
private handlers: Record<string, Function> = {};
|
||||
consuming = true;
|
||||
@@ -20,7 +23,8 @@ export default class WorkerService extends Service {
|
||||
super(ctx, 'worker');
|
||||
}
|
||||
|
||||
async *[Context.init]() {
|
||||
*[Service.init]() {
|
||||
if (argv.options.disableWorker) return;
|
||||
this.consume();
|
||||
yield () => {
|
||||
this.consuming = false;
|
||||
|
||||
Reference in new issue
Block a user