修复获取 cpu 核数

This commit is contained in:
whyour
2023-05-30 17:45:47 +08:00
parent f7465759c7
commit 0bbb7c7b89
+1 -1
View File
@@ -1,7 +1,7 @@
import pLimit from "p-limit"; import pLimit from "p-limit";
import os from 'os'; import os from 'os';
const cronLimit = pLimit(os.cpus.length || 3); const cronLimit = pLimit(os.cpus().length);
export function runCronWithLimit<T>(fn: () => Promise<T>): Promise<T> { export function runCronWithLimit<T>(fn: () => Promise<T>): Promise<T> {
return cronLimit(() => { return cronLimit(() => {