Fix process not exiting after run, detect closed job listings
- All entry points with log tee now call logStream.end() + process.exit() (log stream kept event loop alive, blocking next cron run) - easy_apply: detect "no longer accepting applications" and similar closed listing text before reporting as unsupported Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -163,6 +163,16 @@ export async function apply(page, job, formFiller) {
|
||||
}
|
||||
|
||||
if (!eaBtn) {
|
||||
// Check if the listing is closed
|
||||
const closed = await page.evaluate(() => {
|
||||
const text = (document.body.innerText || '').toLowerCase();
|
||||
return text.includes('no longer accepting') || text.includes('no longer available') ||
|
||||
text.includes('this job has expired') || text.includes('job is closed');
|
||||
}).catch(() => false);
|
||||
if (closed) {
|
||||
console.log(` ℹ️ Job closed — no longer accepting applications`);
|
||||
return { status: 'skipped_no_apply', meta };
|
||||
}
|
||||
console.log(` ℹ️ No Easy Apply button found. Page URL: ${page.url()}`);
|
||||
console.log(` Action: job may have been removed, filled, or changed to external apply`);
|
||||
return { status: 'skipped_easy_apply_unsupported', meta };
|
||||
|
||||
Reference in New Issue
Block a user