We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
有个定时任务的问题,执行npm run dev的时候log显示unknown task, 复现代码:https://github.com/0-Captain/schedule 主要代码为schedule文件夹中的两个文件:
// src/schedule/s1.ts import { CommonSchedule, Provide, Schedule } from '@midwayjs/decorator'; @Provide() @Schedule({ type: 'worker', interval: 1000, env: ['prod'], immediate: true, }) export class Test1 implements CommonSchedule { async exec() { console.log('test1'); } }
// src/schedule/s2.ts import { CommonSchedule, Provide, Schedule } from '@midwayjs/decorator'; @Provide() @Schedule({ type: 'worker', interval: 1000, env: ['staging'], immediate: true, }) export class Test2 implements CommonSchedule { async exec() { console.log('test2'); } }
预期结果: 执行cross-env EGG_SERVER_ENV=staging midway-bin dev --ts,打印:test1 执行cross-env EGG_SERVER_ENV=prod midway-bin dev --ts,打印:test2
cross-env EGG_SERVER_ENV=staging midway-bin dev --ts
cross-env EGG_SERVER_ENV=prod midway-bin dev --ts
实际结果: 执行cross-env EGG_SERVER_ENV=staging midway-bin dev --ts,打印:test1 执行cross-env EGG_SERVER_ENV=prod midway-bin dev --ts,打印:无输出,查看egg-schedule.log打印unknown task
The text was updated successfully, but these errors were encountered:
已修复
Sorry, something went wrong.
czy88840616
No branches or pull requests
有个定时任务的问题,执行npm run dev的时候log显示unknown task,
复现代码:https://github.com/0-Captain/schedule
主要代码为schedule文件夹中的两个文件:
预期结果:
执行
cross-env EGG_SERVER_ENV=staging midway-bin dev --ts
,打印:test1执行
cross-env EGG_SERVER_ENV=prod midway-bin dev --ts
,打印:test2实际结果:
执行
cross-env EGG_SERVER_ENV=staging midway-bin dev --ts
,打印:test1执行
cross-env EGG_SERVER_ENV=prod midway-bin dev --ts
,打印:无输出,查看egg-schedule.log打印unknown taskThe text was updated successfully, but these errors were encountered: