mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +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 { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||||
import CronService from '../services/cron';
|
import CronService from '../services/cron';
|
||||||
import EnvService from '../services/env';
|
import EnvService from '../services/env';
|
||||||
import groupBy from 'lodash/groupBy';
|
import { DependenceModel, DependenceStatus } from '../data/dependence';
|
||||||
import { DependenceModel } from '../data/dependence';
|
|
||||||
import { Op } from 'sequelize';
|
import { Op } from 'sequelize';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import { CrontabViewModel, CronViewType } from '../data/cronView';
|
import { CrontabViewModel, CronViewType } from '../data/cronView';
|
||||||
|
@ -42,16 +41,14 @@ export default async () => {
|
||||||
order: [['type', 'DESC']],
|
order: [['type', 'DESC']],
|
||||||
raw: true,
|
raw: true,
|
||||||
}).then(async (docs) => {
|
}).then(async (docs) => {
|
||||||
const groups = groupBy(docs, 'type');
|
await DependenceModel.update(
|
||||||
const keys = Object.keys(groups).sort((a, b) => parseInt(b) - parseInt(a));
|
{ status: DependenceStatus.installing, log: [] },
|
||||||
for (const key of keys) {
|
{ where: { id: docs.map((x) => x.id!) } },
|
||||||
const group = groups[key];
|
);
|
||||||
const depIds = group.map((x) => x.id);
|
dependenceService.installDependenceOneByOne(docs);
|
||||||
await dependenceService.reInstall(depIds as number[]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 初始化时执行一次所有的ql repo 任务
|
// 初始化时执行一次所有的 ql repo 任务
|
||||||
CrontabModel.findAll({
|
CrontabModel.findAll({
|
||||||
where: {
|
where: {
|
||||||
isDisabled: { [Op.ne]: 1 },
|
isDisabled: { [Op.ne]: 1 },
|
||||||
|
|
|
@ -99,7 +99,7 @@ export default class DependenceService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private installDependenceOneByOne(
|
public installDependenceOneByOne(
|
||||||
docs: Dependence[],
|
docs: Dependence[],
|
||||||
isInstall: boolean = true,
|
isInstall: boolean = true,
|
||||||
force: boolean = false,
|
force: boolean = false,
|
||||||
|
|
|
@ -61,7 +61,11 @@ handle_log_path() {
|
||||||
|
|
||||||
format_params() {
|
format_params() {
|
||||||
time_format="%Y-%m-%d %H:%M:%S"
|
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=""
|
timeoutCmd=""
|
||||||
if type timeout &>/dev/null; then
|
if type timeout &>/dev/null; then
|
||||||
timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time "
|
timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time "
|
||||||
|
|
Loading…
Reference in New Issue
Block a user