mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:46:06 +08:00
修复schedule进程
This commit is contained in:
parent
eb9217d46e
commit
43d5063293
|
@ -1,10 +1,13 @@
|
||||||
import schedule from 'node-schedule';
|
import schedule from 'node-schedule';
|
||||||
|
import express from 'express';
|
||||||
import { exec } from 'child_process';
|
import { exec } from 'child_process';
|
||||||
import Logger from './loaders/logger';
|
import Logger from './loaders/logger';
|
||||||
import { Container } from 'typedi';
|
import { Container } from 'typedi';
|
||||||
import CronService from './services/cron';
|
import CronService from './services/cron';
|
||||||
import { CrontabStatus } from './data/cron';
|
import { CrontabStatus } from './data/cron';
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
const run = async () => {
|
const run = async () => {
|
||||||
const cronService = Container.get(CronService);
|
const cronService = Container.get(CronService);
|
||||||
const cronDb = cronService.getDb();
|
const cronDb = cronService.getDb();
|
||||||
|
@ -36,9 +39,16 @@ const run = async () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
run();
|
app
|
||||||
Logger.info(`
|
.listen(5800, () => {
|
||||||
|
run();
|
||||||
|
Logger.info(`
|
||||||
################################################
|
################################################
|
||||||
🛡️ 定时任务schedule启动成功 🛡️
|
🛡️ Schedule listening on port: 5800 🛡️
|
||||||
################################################
|
################################################
|
||||||
`);
|
`);
|
||||||
|
})
|
||||||
|
.on('error', (err) => {
|
||||||
|
Logger.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user