将同时读写的并发数从10改为20

This commit is contained in:
nonameShijian 2024-04-20 14:12:57 +08:00
parent 7b939703d3
commit 926c51750d
1 changed files with 3 additions and 3 deletions

View File

@ -439,11 +439,11 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
* @param { (value: T) => Promise<boolean> } predicate * @param { (value: T) => Promise<boolean> } predicate
*/ */
const asyncFilter = async (arr, predicate) => { const asyncFilter = async (arr, predicate) => {
//将arr每10个分为一个数组分别使用Promise.all //将arr每20个分为一个数组分别使用Promise.all
/** @type { boolean[] } */ /** @type { boolean[] } */
const results = []; const results = [];
for (let i = 0; i < arr.length; i += 10) { for (let i = 0; i < arr.length; i += 20) {
const pushArr = arr.slice(i, i + 10); const pushArr = arr.slice(i, i + 20);
results.push( results.push(
...await Promise.all(pushArr.map(predicate)) ...await Promise.all(pushArr.map(predicate))
); );