From c3d85dce77ddfd072576b48858ed4688c1e185b4 Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Sun, 20 Oct 2024 20:30:41 +0800 Subject: [PATCH] slow down the running speed; add the gap when CANNOT_FIND_EXCEPT_JOB_IN_THIS_FILTER_CONDITION --- packages/geek-auto-start-chat-with-boss/index.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/geek-auto-start-chat-with-boss/index.mjs b/packages/geek-auto-start-chat-with-boss/index.mjs index 650fde0..714b181 100644 --- a/packages/geek-auto-start-chat-with-boss/index.mjs +++ b/packages/geek-auto-start-chat-with-boss/index.mjs @@ -407,7 +407,7 @@ async function toRecommendPage (hooks) { await storeStorage(page).catch(() => void 0) await sleepWithRandomDelay(2000) } - await sleepWithRandomDelay(1500) + await sleepWithRandomDelay(3000) await setFilterCondition(filterCondition) try { @@ -591,7 +591,7 @@ async function toRecommendPage (hooks) { reject(err) } }) - await sleepWithRandomDelay(200) + await sleepWithRandomDelay(1000) const startChatButtonInnerHTML = await page.evaluate('document.querySelector(".job-detail-box .op-btn.op-btn-chat")?.innerHTML.trim()') await hooks.newChatWillStartup?.promise(targetJobData) @@ -625,16 +625,17 @@ async function toRecommendPage (hooks) { blockBossNotNewChat.add(targetJobData.jobInfo.encryptUserId) await storeStorage(page).catch(() => void 0) - await sleepWithRandomDelay(750) + await sleepWithRandomDelay(1500) const closeDialogButtonProxy = await page.$('.greet-boss-dialog .greet-boss-footer .cancel-btn') await closeDialogButtonProxy.click() - await sleepWithRandomDelay(1000) + await sleepWithRandomDelay(2000) } // #endregion } catch (err) { if (err instanceof Error) { switch (err.message) { case 'CANNOT_FIND_EXCEPT_JOB_IN_THIS_FILTER_CONDITION': { + await sleepWithRandomDelay(25 * 1000) continue iterateFilterCondition; } case 'STARTUP_CHAT_ERROR_DUE_TO_TODAY_CHANCE_HAS_USED_OUT': {