mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复启动时依赖配置未初始化
This commit is contained in:
parent
0a723318a1
commit
7f3e60423b
|
@ -10,11 +10,31 @@ import config from '../config';
|
|||
import { CrontabViewModel, CronViewType } from '../data/cronView';
|
||||
import { initPosition } from '../data/env';
|
||||
import { AuthDataType, SystemModel } from '../data/system';
|
||||
import SystemService from '../services/system';
|
||||
|
||||
export default async () => {
|
||||
const cronService = Container.get(CronService);
|
||||
const envService = Container.get(EnvService);
|
||||
const dependenceService = Container.get(DependenceService);
|
||||
const systemService = Container.get(SystemService);
|
||||
|
||||
// 初始化更新 linux/python/nodejs 镜像源配置
|
||||
const systemConfig = await systemService.getSystemConfig();
|
||||
if (systemConfig.info?.pythonMirror) {
|
||||
systemService.updatePythonMirror({
|
||||
linuxMirror: systemConfig.info?.linuxMirror,
|
||||
});
|
||||
}
|
||||
if (systemConfig.info?.linuxMirror) {
|
||||
systemService.updateLinuxMirror({
|
||||
linuxMirror: systemConfig.info?.linuxMirror,
|
||||
});
|
||||
}
|
||||
if (systemConfig.info?.nodeMirror) {
|
||||
systemService.updateNodeMirror({
|
||||
linuxMirror: systemConfig.info?.linuxMirror,
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化新增默认全部任务视图
|
||||
CrontabViewModel.findAll({
|
||||
|
@ -46,7 +66,9 @@ export default async () => {
|
|||
{ status: DependenceStatus.queued, log: [] },
|
||||
{ where: { id: docs.map((x) => x.id!) } },
|
||||
);
|
||||
dependenceService.installDependenceOneByOne(docs);
|
||||
setTimeout(() => {
|
||||
dependenceService.installDependenceOneByOne(docs);
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
// 初始化时执行一次所有的 ql repo 任务
|
||||
|
|
|
@ -126,7 +126,7 @@ export default class SystemService {
|
|||
return { code: 200, data: info };
|
||||
}
|
||||
|
||||
public async updateNodeMirror(info: SystemModelInfo, res: Response) {
|
||||
public async updateNodeMirror(info: SystemModelInfo, res?: Response) {
|
||||
const oDoc = await this.getSystemConfig();
|
||||
await this.updateAuthDb({
|
||||
...oDoc,
|
||||
|
@ -141,8 +141,8 @@ export default class SystemService {
|
|||
command,
|
||||
{
|
||||
onStart: async (cp) => {
|
||||
res.setHeader('QL-Task-Pid', `${cp.pid}`);
|
||||
res.end();
|
||||
res?.setHeader('QL-Task-Pid', `${cp.pid}`);
|
||||
res?.end();
|
||||
},
|
||||
onEnd: async () => {
|
||||
this.sockService.sendMessage({
|
||||
|
@ -177,7 +177,7 @@ export default class SystemService {
|
|||
return { code: 200, data: info };
|
||||
}
|
||||
|
||||
public async updateLinuxMirror(info: SystemModelInfo, res: Response) {
|
||||
public async updateLinuxMirror(info: SystemModelInfo, res?: Response) {
|
||||
const oDoc = await this.getSystemConfig();
|
||||
await this.updateAuthDb({
|
||||
...oDoc,
|
||||
|
@ -203,8 +203,8 @@ export default class SystemService {
|
|||
command,
|
||||
{
|
||||
onStart: async (cp) => {
|
||||
res.setHeader('QL-Task-Pid', `${cp.pid}`);
|
||||
res.end();
|
||||
res?.setHeader('QL-Task-Pid', `${cp.pid}`);
|
||||
res?.end();
|
||||
},
|
||||
onEnd: async () => {
|
||||
this.sockService.sendMessage({
|
||||
|
|
Loading…
Reference in New Issue
Block a user