mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +08:00
修复获取 cpu 核数
This commit is contained in:
1 parent
f7465759c7
commit
0bbb7c7b89
1 file changed
+1
-1
@@ -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(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user