Skip to content

Commit

Permalink
fix: 只有一个账号会立刻停止的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Sep 7, 2024
1 parent 9f5d398 commit 672ebee
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions bypasscf_likeUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,23 @@ function delayClick(time) {
return browser;
}); // 等待当前批次的任务完成
const browsers = await Promise.all(batch);
console.log(
`批次 ${Math.floor(i / maxConcurrentAccounts) + 1} 完成,关闭浏览器...`
);

// 关闭所有浏览器实例
for (const browser of browsers) {
await browser.close();
}

// 如果还有下一个批次,等待指定的时间
if (i + maxConcurrentAccounts < totalAccounts) {
// 如果还有下一个批次,等待指定的时间,同时,如果总共只有一个账号,也需要继续运行
if (i + maxConcurrentAccounts < totalAccounts || i === 0) {
console.log(`等待 ${delayBetweenBatches / 1000} 秒`);
await new Promise((resolve) =>
setTimeout(resolve, delayBetweenBatches)
);
}
console.log(
`批次 ${
Math.floor(i / maxConcurrentAccounts) + 1
} 完成,关闭浏览器...,浏览器对象:${browsers[0]}`
);
// 关闭所有浏览器实例
for (const browser of browsers) {
await browser.close();
}
}

console.log("所有账号登录操作已完成");
Expand Down

0 comments on commit 672ebee

Please sign in to comment.