enhance perf of check if it is hiring of ghosting reminder

This commit is contained in:
geekgeekrun
2026-02-05 20:57:35 +08:00
parent ddc8a81c7c
commit 27652824d9
@@ -24,7 +24,7 @@ import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
import { messageForSaveFilter } from '../../../common/utils/chat-list' import { messageForSaveFilter } from '../../../common/utils/chat-list'
import { RECHAT_CONTENT_SOURCE, RECHAT_LLM_FALLBACK } from '../../../common/enums/auto-start-chat' import { RECHAT_CONTENT_SOURCE, RECHAT_LLM_FALLBACK } from '../../../common/enums/auto-start-chat'
import gtag from '../../utils/gtag' import gtag from '../../utils/gtag'
import { JobHireStatus } from '@geekgeekrun/sqlite-plugin/dist/enums'; import { JobHireStatus } from '@geekgeekrun/sqlite-plugin/dist/enums'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import cheerio from 'cheerio' import cheerio from 'cheerio'
@@ -136,16 +136,24 @@ async function checkJobIsClosed() {
} }
positionNameElHandle.click() positionNameElHandle.click()
try { try {
const targetPage = await waitForPage(pageMapByName.boss!.browser(), async (page) => { const targetPage = await waitForPage(
pageMapByName.boss!.browser(),
async (page) => {
const url = page.url() const url = page.url()
if ( if (
url.startsWith(`https://www.zhipin.com/job_detail/${encryptJobId}`) && url.startsWith(`https://www.zhipin.com/job_detail/${encryptJobId}`) &&
(await page.evaluate(() => document.readyState === 'complete')) (await page.evaluate(
() =>
!!document.querySelector('#main .job-banner') ||
!!document.documentElement.innerText?.includes(`您访问的页面不存在`)
))
) { ) {
return true return true
} }
return false return false
}) },
{ timeout: 15 * 1000 }
)
const htmlContent = await targetPage.content() const htmlContent = await targetPage.content()
if (htmlContent) { if (htmlContent) {
const $ = cheerio.load(htmlContent) const $ = cheerio.load(htmlContent)