mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改初始化依赖安装逻辑
This commit is contained in:
parent
81e2bbb14c
commit
666545ff03
|
@ -4,8 +4,7 @@ import { Container } from 'typedi';
|
|||
import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||
import CronService from '../services/cron';
|
||||
import EnvService from '../services/env';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import { DependenceModel } from '../data/dependence';
|
||||
import { DependenceModel, DependenceStatus } from '../data/dependence';
|
||||
import { Op } from 'sequelize';
|
||||
import config from '../config';
|
||||
import { CrontabViewModel, CronViewType } from '../data/cronView';
|
||||
|
@ -42,16 +41,14 @@ export default async () => {
|
|||
order: [['type', 'DESC']],
|
||||
raw: true,
|
||||
}).then(async (docs) => {
|
||||
const groups = groupBy(docs, 'type');
|
||||
const keys = Object.keys(groups).sort((a, b) => parseInt(b) - parseInt(a));
|
||||
for (const key of keys) {
|
||||
const group = groups[key];
|
||||
const depIds = group.map((x) => x.id);
|
||||
await dependenceService.reInstall(depIds as number[]);
|
||||
}
|
||||
await DependenceModel.update(
|
||||
{ status: DependenceStatus.installing, log: [] },
|
||||
{ where: { id: docs.map((x) => x.id!) } },
|
||||
);
|
||||
dependenceService.installDependenceOneByOne(docs);
|
||||
});
|
||||
|
||||
// 初始化时执行一次所有的ql repo 任务
|
||||
// 初始化时执行一次所有的 ql repo 任务
|
||||
CrontabModel.findAll({
|
||||
where: {
|
||||
isDisabled: { [Op.ne]: 1 },
|
||||
|
|
|
@ -99,7 +99,7 @@ export default class DependenceService {
|
|||
}
|
||||
}
|
||||
|
||||
private installDependenceOneByOne(
|
||||
public installDependenceOneByOne(
|
||||
docs: Dependence[],
|
||||
isInstall: boolean = true,
|
||||
force: boolean = false,
|
||||
|
|
|
@ -61,7 +61,11 @@ handle_log_path() {
|
|||
|
||||
format_params() {
|
||||
time_format="%Y-%m-%d %H:%M:%S"
|
||||
mtime_format="%Y-%m-%d %H:%M:%S.%3N"
|
||||
if [[ $is_macos -eq 1 ]]; then
|
||||
mtime_format=$time_format
|
||||
else
|
||||
mtime_format="%Y-%m-%d %H:%M:%S.%3N"
|
||||
fi
|
||||
timeoutCmd=""
|
||||
if type timeout &>/dev/null; then
|
||||
timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time "
|
||||
|
|
Loading…
Reference in New Issue
Block a user