mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
依赖改为串行安装
This commit is contained in:
parent
8b1906c786
commit
8d2c62d6d1
|
@ -27,11 +27,7 @@ export default async () => {
|
|||
if (Object.prototype.hasOwnProperty.call(groups, key)) {
|
||||
const group = groups[key];
|
||||
const depIds = group.map((x) => x.id);
|
||||
for (const dep of depIds) {
|
||||
if (dep) {
|
||||
await dependenceService.reInstall([dep]);
|
||||
}
|
||||
}
|
||||
await dependenceService.reInstall(depIds as number[]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class DependenceService {
|
|||
return tab;
|
||||
});
|
||||
const docs = await this.insert(tabs);
|
||||
this.installOrUninstallDependencies(docs);
|
||||
await this.installDependenceOneByOne(docs);
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ export default class DependenceService {
|
|||
status: DependenceStatus.installing,
|
||||
});
|
||||
const newDoc = await this.updateDb(tab);
|
||||
this.installOrUninstallDependencies([newDoc]);
|
||||
await this.installDependenceOneByOne([newDoc]);
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ export default class DependenceService {
|
|||
{ where: { id: ids } },
|
||||
);
|
||||
const docs = await DependenceModel.findAll({ where: { id: ids } });
|
||||
this.installOrUninstallDependencies(docs, false, force);
|
||||
await this.installDependenceOneByOne(docs, false, force);
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,18 @@ export default class DependenceService {
|
|||
}
|
||||
}
|
||||
|
||||
private async installDependenceOneByOne(
|
||||
docs: Dependence[],
|
||||
isInstall: boolean = true,
|
||||
force: boolean = false,
|
||||
) {
|
||||
for (const dep of docs) {
|
||||
if (dep) {
|
||||
await this.installOrUninstallDependencies([dep], isInstall, force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async reInstall(ids: number[]): Promise<Dependence[]> {
|
||||
await DependenceModel.update(
|
||||
{ status: DependenceStatus.installing, log: [] },
|
||||
|
@ -105,7 +117,7 @@ export default class DependenceService {
|
|||
);
|
||||
|
||||
const docs = await DependenceModel.findAll({ where: { id: ids } });
|
||||
this.installOrUninstallDependencies(docs);
|
||||
await this.installDependenceOneByOne(docs);
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user