修复依赖安装流程

This commit is contained in:
whyour
2023-06-18 15:51:35 +08:00
parent 87455cebc0
commit 84828865f7
6 changed files with 35 additions and 27 deletions
+11 -4
View File
@@ -1,10 +1,17 @@
import pLimit from "p-limit";
import os from 'os';
const cronLimit = pLimit(os.cpus().length);
const cpuLimit = pLimit(os.cpus().length);
const oneLimit = pLimit(1);
export function runCronWithLimit<T>(fn: () => Promise<T>): Promise<T> {
return cronLimit(() => {
export function runWithCpuLimit<T>(fn: () => Promise<T>): Promise<T> {
return cpuLimit(() => {
return fn();
});
}
}
export function runOneByOne<T>(fn: () => Promise<T>): Promise<T> {
return oneLimit(() => {
return fn();
});
}