修复schedule进程

This commit is contained in:
whyour 2021-05-04 12:10:50 +08:00
parent eb9217d46e
commit 43d5063293

View File

@ -1,10 +1,13 @@
import schedule from 'node-schedule';
import express from 'express';
import { exec } from 'child_process';
import Logger from './loaders/logger';
import { Container } from 'typedi';
import CronService from './services/cron';
import { CrontabStatus } from './data/cron';
const app = express();
const run = async () => {
const cronService = Container.get(CronService);
const cronDb = cronService.getDb();
@ -36,9 +39,16 @@ const run = async () => {
});
};
run();
Logger.info(`
################################################
🛡 schedule启动成功 🛡
################################################
`);
app
.listen(5800, () => {
run();
Logger.info(`
################################################
🛡 Schedule listening on port: 5800 🛡
################################################
`);
})
.on('error', (err) => {
Logger.error(err);
process.exit(1);
});